Skip to main content

Notifications

Power Apps Experimental Features
Suggested answer

Issue with decodeUriComponent('%0D') - related to equivalent

Posted on by 2
Hello,
 
I am requesting assistance to resolve the issues with “Handle empty data scenarios in CSV file” that related to “/r equivalent” from YouTube by Reza Dorrani. I followed step by step until I ended up having issues at frame time, 23:35 that includes with a snapshot. that was the last thing that I need help before I can finished up to the last session. I enjoyed learning the processes how the Power Automate can apply to the projects that I am working on.
 
Handle empty data scenarios in CSV file

Column Index [7] = Creation Date
1. 22:45 - split(item(),',)?[7] - no issue
2. 22:51 - if(equals(split(item(),',')?[7],''),null,split(item(),',')?[7]) - no issue
3. 23:35 - if(equals(replace(split(item(),',')?[7],''),decodeUriComponent('%0D'),''),null,split(item(),',')?[7]) - failed, the issue occurred - related to /r equivalent
where I saw double apostrophes such as if(equals(replace(split(item(),',')?[7],''),decodeUriComponent('%0D'),''), ''
then the rest of expression cut off before you clicked "Update" button. I was unsure if the power expression statement is correct since it failed at multiple times.
 
if(equals(replace(split(item(),',')?[7],decodeUriComponent('%0D'),''),'',null,split(item(),',')?[7]))
  • Suggested answer
    FLMike Profile Picture
    FLMike 23,258 on at
    Issue with decodeUriComponent('%0D') - related to equivalent
    Hi,
     
    So question, you are trying to remove the index [7] which you say is an /r , now is the file holding a /r or is it just that you know they are there?
     
    Can you give one line of complete data, so that
     
    Also when I try to put your code into a (not clearner but a format to make clear what goes with what hierarchy wise.
     
    it does not look right to me and here is why
    Let's break it down
     
    1. Why do you check for null after you do the replace? You should check before, otherwise it can fail
    It seems what you WANT is, if that equals then do something but you wrote it incorrectly
     
    if(
       equals(
            // ok so take the index of 7 and replace /r with '' (empty string but NOT null)
            replace(split(item(),',')?[7],decodeUriComponent('%0D'),'')
          '',null,split(item(),',')?[7])
     
    )
     
     Ok lets start our break down
     
    if(equals(replace(split(item(),',')?[7],decodeUriComponent('%0D'),''),'',null,split(item(),',')?[7]))
     
    Ok remember Ifs do the following
    If( something, is true, do x, if not true do y)
     
    But you didn't write yours that way. look closely
     
    if(
    // so we need JUST the expression to evaluate between the equals() // but you have a lot more
     
        equals(replace(split(item(),',')?[7],decodeUriComponent('%0D'),'') 
        Problem
         #1 is I need to close the Equals.. but i cannot. The above code closes the REPLACE statement only, so you should have another ) right after close the replace, but you do not, you have an , and then bla bla.. so its like you were trying to do the if(true/false, true, false) but wrote the stuff in the equals section so, I am going to add the ) in my third writeup below
     
     
     
    ,'',null,split(item(),',')?[7])
     
    )
     
    // fixing #3
    if(
    // so we need JUST the expression to evaluate between the equals() // but you have a lot more
     
        equals(replace(split(item(),',')?[7],decodeUriComponent('%0D'),'')) <== I added this to close the equals
       NOW, i can use your next comma,,which belongs to the IF not the equals
     
    // Next Problem. You should have an expression to return or do something, you dno't you have the below stuff left, none of this stuff will work.
    As you see I moved part of it down to represent the False part of the If, the issue is you still have that ", null
    which doesn't make sense. you probably JUST want the 
      null
         //'',null and get rid of this
     
    ,
        // I used the comma right after null, to be the FALSE section of your if
       split(item(),',')?[7])
    )
     
    Clean Copy
    if(
        equals(replace(split(item(),',')?[7],decodeUriComponent('%0D'),''))
    , 
      null
    ,
       split(item(),',')?[7])
    )
     
    And thats where I believe your issue is
     
    If this helps please mark as the answer.
     
     

Helpful resources

Quick Links

Welcome to the Power Platform…

We are thrilled to unveil the newly-launched Power Platform Communities!…

Community Update Sept 16…

Power Platform Community Update…

Welcome to the new Power Platform Community!…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 140,719

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,355

Leaderboard

Featured topics