web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Unable to process temp...
Power Automate
Answered

Unable to process template language expressions in action

(0) ShareShare
ReportReport
Posted on by 20
Dear all,
 
This is my first post in the Microsoft Power Automate Community Forum and I hope anyone can help me.
 
Currently I am working in a small project for my job through which I want to fetch specific data from PDFs using AI Builder and input this data into an excel table (Later on I will  input the data into a legacy system using a Desktop flow). 
 
The issue is that the dates in the PDFs are in format "dd-Mon-yyyy" when I need "dd-MM-yyyy". So, instead of 02-Jun-2023 I need 02-06-2023. The PDFs I work with are hedge trade confirmations, with:
1. Trade Date
2. Effective Date
3. Maturity Date
 
One collection of PDFs I trained has only Trade and Effective Date and the other collection Trade and Maturity Date. So, for example, if I want to fetch information from a PDF which only contains Trade and Effective Date (But not Maturity Date), the flow I created works until it reaches the action that you can see below, with the error message:
 
ivanalvarez_0-1685707769885.png

 

It looks like if variable created through the AI Builder action doesn't exist in a specific document (being null) the flow gives this error. I tried several things, like adding a conditional, but I couldn't insert the "Initialize variable 3" in it because this kind of action is not allowed.

 

Could someone help me to solve this problem? Happy to provide more information if needed.

 

Thanks in advance

Iván

Categories:
I have the same question (0)
  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @ivanalvarez ,

     

    We cannot use action 'Initialize variable' in the loop , but we can use 'set variable' in it.

    Sample:

    vxiaochenmsft_0-1685944663598.png

     

    Best Regards,

    Wearsky

  • CedrickB Profile Picture
    Microsoft Employee on at

    Hi,

    It looks like you are trying to perform some conversion logic in the variable initialization.

    So if the data retrieved is empty, then it will fail.

    Did you consider using the new typed fields feature to perform this conversion instead?

    See https://learn.microsoft.com/ai-builder/extract-dates-and-numbers 

  • ivanalvarez Profile Picture
    20 on at

    Thanks for your message Wearsky. This solution doesn't work since it's not possible to perform a conversion logic within a variable initialization action when the data retrieved is empty, as the answer below states.

  • Antoine2F Profile Picture
    Microsoft Employee on at

    The idea of Wearsky is to initialize variable first, with a default value (blank), even before running AI Builder model.

     

    Then you use a condition to set this variable to the AI Builder output or not, depending on the value of AI Builder output.

  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @ivanalvarez ,

     

    Not sure if I understood the issue correctly.


     

    like adding a conditional, but I couldn't insert the "Initialize variable 3" in it because this kind of action is not allowed.


    My solution works when using variables in conditions.

    If I misunderstood, could you share screenshots, formulas and running results?

     

    Best Regards,

    Wearsky

  • ivanalvarez Profile Picture
    20 on at

    Hi Cedrick, thanks for your message. 

     

    Indeed, you summarized pretty well my issue. However, I am not sure whether I am able to use the new typed fields feature. As you can see in the screenshot below, I can only select among these 3 options regarding the order but I cannot customize the format further.

     

     

    ivanalvarez_0-1685954247702.png

    Best,

    Iván

  • CedrickB Profile Picture
    Microsoft Employee on at

    As mentioned in the documentation https://learn.microsoft.com/ai-builder/extract-dates-and-numbers#supported-date-formats we support several date formats.

    For instance, selecting "Year, Month, Date" is supposed to capture automatically either 1-18-2020 or 01Aug2020 or 01/08/2020 ... without having to provide more details on the format.

  • ivanalvarez Profile Picture
    20 on at

    I understand. The dates in the documents I am using to extract data are in the format 01-Aug-2020 but what I want to be input in the Excel file is 01-08-2020. So my problem is not how to fetch the data but how to convert it to the format I want.

  • ivanalvarez Profile Picture
    20 on at

    Hello again @v-xiaochen-msft @Antoine2F 

     

    I tried this using the following expressions: 

    For the condition: empty(outputs('Extract_information_from_forms')?['body/responsev2/predictionOutput/labels/Maturityc082e397ab463c42215830fd94504a91/value'])
     
    For setting the variable if the condition applies: 
    formatDateTime(parseDateTime(outputs('Extract_information_from_forms')?['body/responsev2/predictionOutput/labels/Maturityc082e397ab463c42215830fd94504a91/value']), 'dd-MM-yyyy''en-GB')

    ivanalvarez_1-1685960179532.png

     

     

     

    And the result:

    ivanalvarez_0-1685960148659.png

     

  • ivanalvarez Profile Picture
    20 on at

    Hello all, the solution that @v-xiaochen-msft provided apparently worked. I had made a mistake in the way of setting up the condition and corrected it to this: 

    ivanalvarez_0-1685968334471.png

    Thank you all!

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 382

#2
Valantis Profile Picture

Valantis 370

#3
David_MA Profile Picture

David_MA 300 Super User 2026 Season 1

Last 30 days Overall leaderboard