In my JSON results, I'm trying to see if a particular object exists, and if it does exist, what is the count. I'm using length
expression but it seems to be failing for me with error:
The template function 'lenth' is not defined or not valid.
Here is my Get_Ticket
object:
{
"TicketInfo": {
"key1": "val1",
"key2": "val2",
"key3": "val3"
},
"TicketEquipmentInfo": [{
"EquipKey1": "val1",
"EquipKey2": "val2"
}, {
"EquipKey1": "val3",
"EquipKey2": "val3"
}]
}
Here is my expression:
if(contains(body('Get_Ticket'), 'TicketEquipmentInfo'), if(greater(lenth(body('Get_Ticket')['TicketEquipmentInfo']), 0), 'Found at least 1 piece of Equipment', '<leave blank, empty array found>'), '<leave blank, no array found>')
What am I doing wrong? Also open to suggestions to make this expression more efficient without having to modify the logic app design.
question from:
https://stackoverflow.com/questions/65832633/logicapp-how-to-use-length-to-check-if-collection-is-empty 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…