Hi ,
I need to verify if the array length is greater than 0 . Itry using : @greater(length(body('Get_records_sqlTable')?['value']), 0)
but the condition is alway true , even the outputs form my get_records is [] .
Thanks
Solved! Go to Solution.
Hi @kchakor,
Could we take use of the empty fucntion instead of the length?
For checking if the array is empty, we could using the following formula:
@empty(body('Get_rows')?['value'])
Which would return true if object, array, or string is empty (for array, means no elements, 0 length).
For the formula you used here, try to convert the 0 use the int function:
@greater(length(body('Get_rows')?['value']),int('0'))
See if that would help.
Regards,
Michael
Hi @kchakor,
Could we take use of the empty fucntion instead of the length?
For checking if the array is empty, we could using the following formula:
@empty(body('Get_rows')?['value'])
Which would return true if object, array, or string is empty (for array, means no elements, 0 length).
For the formula you used here, try to convert the 0 use the int function:
@greater(length(body('Get_rows')?['value']),int('0'))
See if that would help.
Regards,
Michael
it's work fine.
Thank you
Hi @kchakor,
If convenient, would you please accept the workable posts as the solution?
So that others would find it more easily.
Regards,
Michael
I have a similiar problem where I am building arrays in a for each and only want to create files or tables out of them if they are not empty. When using the function within a condition:
@not(equals(empty(variables('check')), TRUE)) or even @not(equals(empty(variables('check')), bool(1))) or even the length and greater than int(o) , because int('o') throws an expression error for me when trying to save, I still get inconsistent results.
It will not producce tables for arrays that have content, and it creates tables for empty arrays - it's just inconsistent in how it evaluates it. What am I doing wrong here?