In operator within an if statement not functioning as expected

Comments

1 comment

  • Avatar
    Nathan Beltran

    You can use parse regex field and multi to break up the array of numbers in the field called "quantityAvailable". Then run the if statement to match on ("0" , " " , "[0," , ",0]")

    _sourcecategory=*/api/mcs/out AND isOrderable*
    | json field=_raw "isOrderable" as success_or_fail
    | json field=_raw "distributionCenterInventoryData.*[0].quantityAvailable" as quantityAvailable
    | json field=_raw "distributionCenterInventoryData.*[0].vendorDistributionCenterId" as vendorDistributionCenterId
    | parse field = vendorDistributionCenterId "[*," as vendorDistributionCenterId
    | if("true" matches success_or_fail, "Success", "Fail") as success_or_fail
    | parse regex field=quantityavailable "(?:\[|\,|)(?<field1>.*?)(?:\]|\,)" multi
    | if(field1 in ("0" , " " , "[0," , ",0]"), "Out of Stock", "In Stock") as stock

     

    0
    Comment actions Permalink

Please sign in to leave a comment.