[Salesforce] SOQL 문의 HAVING 사용법

SOQL 문의 HAVING

HAVING에서는 GROUP BY로 그룹화한 결과에 대해 좁혀 조건을 넣을 수 있습니다.

좁힌 조건이라는 의미에서는 WHERE와 비슷하지만, WHERE에서는 그룹핑하기 전, HAVING은 그룹핑한 후입니다.

다음 샘플은 기회의 리드 소스로 그룹화하고 동일한 값의 레코드 수가 1 이상인 리드 소스별 금액을 표시합니다.

AggregateResult[] results = [SELECT LeadSource, SUM(Amount) summary 
                               FROM Opportunity 
                               GROUP BY LeadSource 
                               HAVING Count(LeadSource) > 1];
for(AggregateResult ar: results){
  System.debug('LeadSource='+ ar.get('LeadSource') 
                   + ':Amount='+ ar.get('summary'));
}

디버그 결과

LeadSource=LeadSource1:Amount=2
LeadSource=LeadSource2:Amount=3

[Salesforce] How to use HAVING in SOQL statements

SOQL statement HAVING

HAVING allows you to enter filtering conditions for the results grouped by GROUP BY.

It is similar to WHERE in that it is a filtering condition, but WHERE is before grouping and HAVING is after grouping.

The following sample groups by the lead source of the opportunity and displays the amount by lead source where the number of records with the same value is 1 or more.

AggregateResult[] results = [SELECT LeadSource, SUM(Amount) summary 
                               FROM Opportunity 
                               GROUP BY LeadSource 
                               HAVING Count(LeadSource) > 1];
for(AggregateResult ar: results){
  System.debug('LeadSource='+ ar.get('LeadSource') 
                   + ':Amount='+ ar.get('summary'));
}

Debugging Results

LeadSource=LeadSource1:Amount=2
LeadSource=LeadSource2:Amount=3

[SalesforceAgentforceSpecialistCertification]資格試験勉強1

資格試験勉強

合格体験記情報収集

【第184回】 Salesforce 認定 AI スペシャリスト 資格試験 合格体験記

https://note.com/nobuyukiwatanabe/n/n08ac6aee98a4

Salesforce 認定 AIスペシャリストに合格したよ

https://sf.forum.circlace.com/articles/1063432301242589184

Salesforce認定AIスペシャリスト試験の対策講座

https://note.com/salesforce777/n/n3163e81ca0ef

【受験体験記】「Salesforce 認定 AI スペシャリスト」に合格しました
https://quanz.co.jp/blog/salesforce/3322

[Salesforce]JSENCODE

JSENCODE

백슬래시 () 등의 이스케이프 문자를 아포스트로피 (‘) 등의 안전하지 않은 JavaScript 문자의 전에 삽입해, JavaScript 로 사용하는 텍스트 캐릭터 라인이나 편지 병합 항목치를 encode 합니다.

페이지를 로드할 때 JavaScript가 실행되고 경고가 표시됩니다.

<script>var ret = "foo";alert('xss');//";</script>

이 경우 JavaScript가 실행되지 않도록 JSENCODE 함수를 사용하십시오.

<script>var ret = "{!JSENCODE($CurrentPage.parameters.retURL)}";</script>

[Salesforce]JSENCODE

JSENCODE

Encode text strings and merge field values ​​for use in JavaScript by inserting an escape character, such as a backslash (), before unsafe JavaScript characters, such as an apostrophe (‘).

The JavaScript runs when the page loads and displays the alert.

<script>var ret = "foo";alert('xss');//";</script>

In this case, use the JSENCODE function to prevent JavaScript from being executed. Example

<script>var ret = "{!JSENCODE($CurrentPage.parameters.retURL)}";</script>