epipko
05/01/2023, 3:32 AM<cfset line_items = jsonData.order.line_items>
<cfloop array="#line_items#" index="line_item">
<cfset line_item_sku = #line_item.sku#>
</cfloop>
This time, for some reason "sku" is not defined (Element SKU is undefined in LINE_ITEM.).
Question: how do I make sku = 'XX' if it's not defined.
I've tried Elvis notation, but without success (<cfset line_item_sku = #line_item.sku#?:"XX">)Tomy Saman
05/01/2023, 5:37 AMTomy Saman
05/01/2023, 5:38 AM<cfset line_item_sku = isDefined("line_item.sku") ? line_item.sku : "xx">Myka Forrest
05/01/2023, 1:27 PMstructKeyExists() to check if it exists in the struct. BTW, you don't need the pounds (#...# ) around the variable when you are setting line_item_sku.dfgrumpy
05/01/2023, 1:47 PM<cfset line_item_sku = line_item?.sku ?: 'XX'>epipko
05/01/2023, 4:01 PMMyka Forrest
05/01/2023, 4:03 PM<cfset mystring = "My name is #name#" />
<cfset myOtherString = aVariable />epipko
05/01/2023, 4:09 PM