Tuesday 16 August 2016

Array Variable in siebel eScript

Hello All,

While working with siebel eScript I got a requirement to use array for storing some variables.
Arrays work like normal JavaScript variable in siebel the difference is just in the declaration and the dimension.
Below code describes how to use array.

Sample code looked like.


      var Result= new Array();

      for(var x = 1; x <= 5; x++)
      {  
        // Dynamically assign value in Array variable
          Result[x] = x;
          Outputs.SetProperty('Output'+x,Result[x]);                                                            
      }

the oputput of this will be,
Output1 = 1
Output2 = 2
Output3 = 3
Output4 = 4
Output5 = 5

we can also declare multiple dimensional arrays also,


      var Result= new Array();
// or we can explicitly specify multi dimensional arrays var Result= new Array(x,y);

      for(var x = 1; x <= 5; x++)
      {  
        for(var y = 1; y <= 5; y++)
         {
        // Dynamically assign value in variable
          Result[x,y] = x+y;
          Outputs.SetProperty('Output'+x+y,Result[x,y]);
         }                                                        
      }


the oputput of this will be,
Output11 = 2
Output12 = 2
...
Output21 = 3
Output22 = 4
...
Output51 = 6
Output55 = 10

we can create hierarchical property sets from the outputs depending on the format we are required to return output.

for Creating Hierarchical property sets refer the post http://www.siebelfoundations.com/2016/08/working-with-property-sets-in-siebel.html

No comments:

Post a Comment

Siebel GoTo View - Handling Realtime cases

 Hello All,  We all must have used GoTo view functionality of siebel to navigate to a particular view from current view. What if the require...