Skip to main content
October 28, 2021
Question

converting

  • October 28, 2021
  • 9 replies
  • 0 views

Hi, using local variable, i am calling expression rule, which gives category codes as output, now i neeed to convert this local!updatecategorycodes into array form to use contains() function.

can anyone please help me

local!updateCategoryCodes:index(
rule!CNAM_qeGetUpdateCategoryCodes(),
"CATEGORY_CODE",
""
),

    9 replies

    stewart.burchell
    October 28, 2021

    I'm not sure I understand the problem. Assuming the result of rule!CNAM_qeGetUpdateCategoryCodes() is a list of items, then index() WILL return an array to local!updateCategoryCodes, even if the list only has one item in it,.

    stewart.burchell
    October 28, 2021

    Just realized that you may be facing the issue that the index() is returning a List of Variant, and that you may be attempting to reference an item as a string in your contains() function. If so, you need to make sure that both data types are equivalent i.e. turn you List of Variant into a List of Text String by using fn!touniformstring()

    andrewh0007
    October 28, 2021

    I think we'll need a tad more information. We can't see what's in your rule!CNAM_qeGetUpdateCategoryCodes() but it appears to be a query. I'll have a go but it may be well of the mark as more detail is needed.

    If I wanted to know if a query code existed I wouldn't call the query, index to "CATEGORY_CODE" then check with a contains I would instead input the category codes I was looking for into the query (via a!queryFilter()) and check if anything is returned.

    If I'm off the mark, please give more details.

    January 12, 2023

    I still can't find the most appropriate solution to this problem word hurdle

    February 28, 2023

    yes, I completely agree with you, this is a very good and useful article for me. backrooms game

    abhayd3663
    February 28, 2023

    index() will already give you a array of items, did you try the contains() function?