I'm trying to process some data from a webhook where one object is an array. The results populate a word document template.
Amongst other strings that work fine, the array is called "selected_items" and The array fields are "heading", "description" and "quantity"
Sometimes the description is empty and the quantity is 0
What I want to achieve is that when the description is empty, the value is set to the same as the heading value and the heading value is blank
I also want the quantity field to be blank when it is zero.
I tried using the if function when appending the data to a variable, however when I open the function those fields from the array are no longer visible. Ideally I'd like to have something like: if heading == "", "title", "heading"
or: if quantity == 0, '', quantity
Hope you can help
Solved! Go to Solution.
Hi @bf ,
Sometimes, we can use expressions to get invisible fields in dynamic content.
I have made a test for your reference.
Result Screenshot:
Best Regards,
Charlie Choi
After further playing around I have solved it.
The expressions need to be, respectively:
if(empty(items('Build_Line_Items')?['description']),'',items('Build_Line_Items')?['heading'])
if(empty(items('Build_Line_Items')?['description']),items('Build_Line_Items')?['heading'],items('Build_Line_Items')?['description'])
if(equals(items('Build_Line_Items')?['quantity'],'0'),'',items('Build_Line_Items')?['quantity'])
Hi @bf ,
Sometimes, we can use expressions to get invisible fields in dynamic content.
I have made a test for your reference.
Result Screenshot:
Best Regards,
Charlie Choi
Thanks for the reply and sorry for the delayed response. It is good to know that these things can be hidden. The issue I am having is that the array I need to work with is coming from a webhook and does not include an ID or title. When I try your code above I just get "null" for the fields.
Here is a snip from my flow. the selected_items array in the Build Line Items object is straight from the http request received
Any way I can do this without such title and id fields?
After further playing around I have solved it.
The expressions need to be, respectively:
if(empty(items('Build_Line_Items')?['description']),'',items('Build_Line_Items')?['heading'])
if(empty(items('Build_Line_Items')?['description']),items('Build_Line_Items')?['heading'],items('Build_Line_Items')?['description'])
if(equals(items('Build_Line_Items')?['quantity'],'0'),'',items('Build_Line_Items')?['quantity'])
User | Count |
---|---|
96 | |
37 | |
25 | |
23 | |
16 |
User | Count |
---|---|
129 | |
51 | |
48 | |
36 | |
24 |