• Mounika@9999
  • NEWBIE
  • 5 Points
  • Member since 2022

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 4
    Questions
  • 6
    Replies
Hi All,
Need to resolve the warning, which is 'AvoidDeeplyNestedIfStmts'."

Using the following code, I am getting a warning about
Deeply nested if..else statements are hard to read (rule: Design-AvoidDeeplyNestedIfStmts)apex pmdAvoidDeeplyNestedIfStmts
Example code:
 if(String.isNotBlank(brand)){
                   if(brand.contains(';')){
                       arrTemp = brand.split(';');
                       filterTemp = '';
                       for(integer i=0; i< arrTemp.size(); i++){
                           String valueTemp = arrTemp[i];

                           if(String.isNotBlank(valueTemp)){
                               filterTemp += ' XC_Brand__c = \'' + valueTemp + '\' OR';
                           }                            
                       }
                       if(String.isNotBlank(filterTemp)){
                           filterTemp = filterTemp.removeEnd(' OR');
                           prodFilterString += ',(' + filterTemp + '),';
                       }
                   }else{
                       prodFilterString += ',XC_Brand__c = \'' + brand + '\',';
                   }
                   
               }

"I have highlighted the issue."

Please help me out.
Thanks!
Hi All,why it is not displying pls tell me and give me updated code if u find any mistake, Thanks!
 <lightning:recordViewForm objectApiName="ccrz__E_PageLabel__c" recordId="a2w7h000001DjrXAAS">
        <div class="slds-box slds-theme_default">
            <lightning:outputField fieldName="Name"/>
            <lightning:outputField fieldName="CartLineNote"/>
        </div>
 </lightning:recordViewForm>
I checked all the things are correct! field name, record id,object name and accessibility.
Hi All,
Coukd you please help me for this..

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" description="communityExample">
    <div>Hello Aura!</div>
</aura:component>

Shall i missed to add anything else?
Input:
-------
{
    "Rows": [                                                       
        [22847938, "SO", "202303161732488-MG", 1, 0, 0, 0, 1, 2.5, "2023-03-16T00:00:00", "2024-03-16T00:00:00", "OPEN", null, null, "2023-03-16T00:00:00", "009", "PUCG", "N30", true, false, "9800 De Soto Ave. - 009", null, null, "Chatsworth", "CA", "91311", "US", null, 0.0, null, null, 154023, []],
        [22878665, "SO", "202303231535745", 16, 0, 0, 0, 16, 128.25, "2023-03-23T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-23T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178878, []],
        [22878689, "SO", "202303231539239", 6, 0, 0, 0, 6, 19.4, "2023-03-31T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-31T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178902, []]
    ]
}
Expected Output
---------------

{
    "Rows": [                                                       
        [22878689, "SO", "202303231539239", 6, 0, 0, 0, 6, 19.4, "2023-03-31T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-31T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178902, []],
        [22878665, "SO", "202303231535745", 16, 0, 0, 0, 16, 128.25, "2023-03-23T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-23T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178878, []],
        [22847938, "SO", "202303161732488-MG", 1, 0, 0, 0, 1, 2.5, "2023-03-16T00:00:00", "2024-03-16T00:00:00", "OPEN", null, null, "2023-03-16T00:00:00", "009", "PUCG", "N30", true, false, "9800 De Soto Ave. - 009", null, null, "Chatsworth", "CA", "91311", "US", null, 0.0, null, null, 154023, []]
    ]
}
Hi All,
Need to resolve the warning, which is 'AvoidDeeplyNestedIfStmts'."

Using the following code, I am getting a warning about
Deeply nested if..else statements are hard to read (rule: Design-AvoidDeeplyNestedIfStmts)apex pmdAvoidDeeplyNestedIfStmts
Example code:
 if(String.isNotBlank(brand)){
                   if(brand.contains(';')){
                       arrTemp = brand.split(';');
                       filterTemp = '';
                       for(integer i=0; i< arrTemp.size(); i++){
                           String valueTemp = arrTemp[i];

                           if(String.isNotBlank(valueTemp)){
                               filterTemp += ' XC_Brand__c = \'' + valueTemp + '\' OR';
                           }                            
                       }
                       if(String.isNotBlank(filterTemp)){
                           filterTemp = filterTemp.removeEnd(' OR');
                           prodFilterString += ',(' + filterTemp + '),';
                       }
                   }else{
                       prodFilterString += ',XC_Brand__c = \'' + brand + '\',';
                   }
                   
               }

"I have highlighted the issue."

Please help me out.
Thanks!
Hi All,
Coukd you please help me for this..

<aura:component implements="forceCommunity:availableForAllPageTypes" access="global" description="communityExample">
    <div>Hello Aura!</div>
</aura:component>

Shall i missed to add anything else?
Input:
-------
{
    "Rows": [                                                       
        [22847938, "SO", "202303161732488-MG", 1, 0, 0, 0, 1, 2.5, "2023-03-16T00:00:00", "2024-03-16T00:00:00", "OPEN", null, null, "2023-03-16T00:00:00", "009", "PUCG", "N30", true, false, "9800 De Soto Ave. - 009", null, null, "Chatsworth", "CA", "91311", "US", null, 0.0, null, null, 154023, []],
        [22878665, "SO", "202303231535745", 16, 0, 0, 0, 16, 128.25, "2023-03-23T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-23T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178878, []],
        [22878689, "SO", "202303231539239", 6, 0, 0, 0, 6, 19.4, "2023-03-31T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-31T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178902, []]
    ]
}
Expected Output
---------------

{
    "Rows": [                                                       
        [22878689, "SO", "202303231539239", 6, 0, 0, 0, 6, 19.4, "2023-03-31T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-31T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178902, []],
        [22878665, "SO", "202303231535745", 16, 0, 0, 0, 16, 128.25, "2023-03-23T00:00:00", "2024-03-23T00:00:00", "OPEN", null, null, "2023-03-23T00:00:00", "010", "UPSG", "N30", true, false, "13100 Tonopah ST", null, null, "Chatsworth", "CA", "91311-____", "US", null, 0.0, null, null, 178878, []],
        [22847938, "SO", "202303161732488-MG", 1, 0, 0, 0, 1, 2.5, "2023-03-16T00:00:00", "2024-03-16T00:00:00", "OPEN", null, null, "2023-03-16T00:00:00", "009", "PUCG", "N30", true, false, "9800 De Soto Ave. - 009", null, null, "Chatsworth", "CA", "91311", "US", null, 0.0, null, null, 154023, []]
    ]
}