0

Using a variable as a field expression in functions

I would like to use a variable as a parameter in functions that take a field expression if possible.

For instance, the following syntax works.

inList(SALES.COUNTRIES.COUNTRY_NAME, $country_list)

I would like to use a session variable that would contain "SALES.COUNTRIES.COUNTRY_NAME", i.e. something like this.

 

inList($field, $country_list)

This syntax does not work as expected. The function checks if "SALES.COUNTRIES.COUNTRY_NAME" string is in $country_list, it does not check the value of the SALES.COUNTRIES.COUNTRY_NAME field.

Is there a way to let Incorta know that $field should be interpreted as a field expression/reference and not as the actual string value?

5replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Vlad Kaminsky I will work to double check this with our engineering team, but I strongly suspect the inList() function wasn't built to have the first input parameterized.

    Like
  • The first argument of inList should be a possible value of a country, not the name of the column.  It performs a if the value is in the list of the 2nd value.  

    Hope this helps

    Like
  • I guess that you would like to evaluate different columns based on the login user?    We can use CASE statement to accomplish this:

     

    CASE($user='user1', inList(SALES.COUNTRIES.COUNTRY_NAME, $country_list)
    
    , $user='user2', inList(SALES.COUNTRIES.COUNTRY_NAME, $country_list), 1=0)

     

    https://docs.incorta.com/4.8/r-case

    Like
      • Vlad Kaminsky
      • GNC Consulting, Inc.
      • Vlad_Kaminsky
      • 3 mths ago
      • Reported - view

      Dylan Thanks for the idea, Dylan. The first parameter is a field expression in Incorta terms. I ultimately wanted to put the schema name in a variable.

      Like
Like Follow
  • 3 mths agoLast active
  • 5Replies
  • 30Views
  • 3 Following

Product Announcement

Incorta 4.9 is now Generally Available (GA)!!!