Skip to main content
March 31, 2023
Solved

How can I index multiple values of a constant

  • March 31, 2023
  • 9 replies
  • 0 views

Hi,

I have a constant which contains array of text, I want to check if a given value is in the array subset of that constant.

For that I'm using-

contains(

{

cons!TA_CITY_LABEL[1],

cons!TA_CITY_LABEL[3],

cons!TA_CITY_LABEL[4],

cons!TA_CITY_LABEL[7]

.

.

.

and many more

},

local!label

)

I wonder if there is any solution to it as I have to write the name of constant again and again and I'm checking this multiple times on different datasets.

    Best answer by sanchitg0002

    You can use it like cons!name[array of indices], this will save you much time.

    contains(
      cons!TA_CITY_LABEL[{ 1, 3, 4, 7 }],
      local!label
    )

    9 replies

    March 31, 2023

    You can use it like cons!name[array of indices], this will save you much time.

    contains(
      cons!TA_CITY_LABEL[{ 1, 3, 4, 7 }],
      local!label
    )

    harshitb6843
    March 31, 2023

    Oh god! What type of hacks have you started writing, Sanchit?

    March 31, 2023

    Why? is there anything wrong in that? [emoticon:5ce50ea3f9eb49809e861e8733750338]

    harshitb6843
    March 31, 2023

    index(cons!TA_CITY_LABEL,{1,2,3,4},{})

    March 31, 2023

    Oh no I should have done it myself, but what Sanchit suggested above is amazing. Thanks for the help

    March 31, 2023

    Okay, but then I'm not responsible for the things Harshit said above [emoticon:c4563cd7d5574777a71c318021cbbcc8]