Hi, I'm trying to get a flow to convert to PDF but sometimes document might already be a PDF and needs to bypass the convert option. If it has to bypass the convert function, the "Create file" needs to look "Get file Content" instead of "Convert File". I'm trying to learn the expressions any help will be appreciated.
I attempted to write an expression but I'm struggling. It feels like it should be simple.
My current expression: if(body('Convert_file_2'),0,body('Get_file_content_2'),0) gives me this error
Unable to process template language expressions in action 'Create_file_4' inputs at line '0' and column '0': 'The template language function 'if' expects three parameter: the condition to test as the first parameter, the value to return if the condition is true as the second parameter, and the value to return if the condition is false as the third parameter. The function was invoked with '4' parameter(s). Please see https://aka.ms/logicexpressions#if for usage details.'.
Thank you in advance!
Solved! Go to Solution.
Thank you! This is basically what I had to create. I abandoned the formula and hard charged it.
Maybe you can try as below
So Inside the if you can put the Convert File
Hope this may help you
Thanks
I got it to decide if the file is a PDF or not but when I go to "Create File," the flow does not know which choice to pull the information from.
So, above will work if the file is PDF there you can decide whether you skip the convert or need to convert
Also can you tell me what you want to do after that in detail?
Thanks
After the flow decides that it is a PDF, I want to "Create a File" from that content
Hi @GCGJH ,
The if() function expects three parameters, the first parameter should return a boolean, but you provided 4 parameters.
Maybe you could add a Create file Action to both branches of Condition Action
In addition, maybe you could try to use the following formula:
if(endsWith(items('Apply_to_each')?['{FilenameWithExtension}'],'.pdf'),outputs('Get_file_content_2')?['body'],outputs('Convert_file_2')?['body'])
Best Regards,
Charlie Choi
Thank you! This is basically what I had to create. I abandoned the formula and hard charged it.
Hi @GCGJH ,
It seems that you found a way to achieve your needs.
Maybe you could consider marking your reply or mine as a 'Solution' to close the case.
Best Regards,
Charlie Choi
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
63 | |
51 | |
30 | |
29 | |
24 |