Author Topic: Checking Values for Indexed Variables  (Read 2475 times)

Sai Siddhartha

  • GuiXT Forum
  • Newbie
  • *
  • Posts: 47
    • View Profile
Checking Values for Indexed Variables
« on: January 04, 2018, 05:57:33 AM »
Purpose:
To check value of the indexed variable set command must be used.
The set command will obtain the value of indexed variable into a regular variable which can be checked against the value.

Below example demonstrates the value check of the indexed variables using set command.

Liquid UI Code
////////////////////////////// SAPLSMTR_NAVIGATION.E0100 ///////////////////////////////

materialnumber = ["1001","1002","1003","1004","1005"]; // array with material numbers
for(idx=0;idx<5;idx++){     
   set("V[z_temp]" , materialnumber[idx]); // assigning values to temp variable using index
    // conditions for checking value in temp variable           
   if (z_temp == "1005") { 
      println("Material at 5th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1004") {           
      println("Material at 4th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1003") {           
      println("Material at 3th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1002") {           
      println("Material at 2th position in materialnumber array>>>" +z_temp);           
   }
   if (z_temp == "1001") {           
      println("Material at 1th position in materialnumber array>>>" +z_temp);           
   }
}

You can see output on Cornelius output window as per the conditions in script.

See attachment for screenshots