Skip to main content

Notifications

Power Automate - Power Automate Desktop
Answered

How to replace undefined variables.

(0) ShareShare
ReportReport
Posted on by

Hi,

 

When extracting data from a web page, items A and B in the figure below can be extracted, but item C is <td></td> in the html, and when the data is extracted, it becomes an undefined item, and the data is neither blank nor null. Is there a way to assign a specific character (False) to an undefined item in Power Automate Desktop?

Torusan_0-1719279716091.png

 

Kind Regards,
Toru 

Categories:
  • Toru-san Profile Picture
    Toru-san on at
    Re: How to replace undefined variables.

    Hi Deenuji-san,

     

    Thank you for your cooperation.

     

    I was able to get it to work properly.
    Does putting [0][0] after a variable mean that it's a way to specify the index of a list variable?
    I learned a lot from your help. Thank you.

     

    I'd like to ask again if I have the opportunity.

    --

    Kind Regards,
    Toru

  • Verified answer
    Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 6,080 on at
    Re: How to replace undefined variables.

    @Toru-san 

     

    Please refer the below approach:

     

    The datatable's Name column in the first row contains no value.

     

    To assign the first row's first column value to a variable, I first check if the value is null using an if condition with the datatable variable - %datatable[0][0]%.

     

    If a value exists, then I assign it to the variable.

    Deenuji_0-1719399664573.png

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 6,080 on at
    Re: How to replace undefined variables.

    @Toru-san 

     

    You can assign your data table value to set variable like below:

    %DataFromWebPage[0][0]%

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to replace undefined variables.

    Hi Deenuji-san,

     

    Thank you for your reply.

    The first capture is an example of when there is no data, the next capture is an example of when data is present.

    Torusan_0-1719383170635.png

    Torusan_1-1719383185804.png

    --

    Kind Regards,
    Toru

  • Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 6,080 on at
    Re: How to replace undefined variables.

    @Toru-san 

     

    My apologies if my ask is not clear. I am asking screenshot of your data table like below screenshot?

    Deenuji_0-1719304457825.png

     

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to replace undefined variables.

    Hi Deenuji-san,

     

    Thank you for your reply.

    We are sorry, the PAD screen in the image below is in Japanese. The variable DataFromWebPage is set to the value C.
    The image below is the html part. Does it make sense what I'm saying?

    Torusan_0-1719297484941.png

    Torusan_1-1719297499372.png

     

    Kind Regards,
    Toru

     

  • Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 6,080 on at
    Re: How to replace undefined variables.

    @Toru-san 

     

    How is your DataFromWebPage values looks like ? Share some screenshot after hiding all senstive info?

    Just want to see where the C items value present in your datatable.

     

    But this is the syntax to read the value from datatable: 

     

    var variable1 = '%DataFromWebPage[0][0]%';

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

     

     

  • Toru-san Profile Picture
    Toru-san on at
    Re: How to replace undefined variables.

    Hi Deenuji-san,

     

    Thank you for your reply.

    I cannot send it because there is company information in the html source.
    Below is the information I would like to discuss first.

     

    When I extract data from a web page using JavaScript (variable: DataFromWebPage),
    an error occurs in the following part. In other words, the results extracted in <td></td> are neither blank nor null.
    Is there a way to check this using JavaScript, or can I take another action to deal with it?

     

    --
    var variable1 = '%DataFromWebPage%';
    --

     

    Kind Regards,
    Toru

  • Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 6,080 on at
    Re: How to replace undefined variables.

    @Toru-san 

     

    You can use JavaScript to check if your C items have any value or are null, and then assign that value to a variable.

    If you're unsure how to proceed, please share the HTML code of your C item, and I will help you accomplish this.

     


    Thanks,
    Deenuji Loganathan 👩‍💻
    Automation Evangelist 🤖
    Follow me on LinkedIn 👥

    -------------------------------------------------------------------------------------------------------------
    If I've helped solve your query, kindly mark my response as the solution ✔ and give it a thumbs up!👍 Your feedback supports future seekers 🚀

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard