Monday, 15 August 2016

How to work with input of Array Type in Siebel eScript

Hello All,

Recently I had a requirement wherein I was getting multiple values in inputs and had to use the values one by one in my code ,perform some calculation till all values have been read from input.
The requirement can be summarized as, suppose we are given 5 Service Request number in input and we are required to perform some operation on each of them.

  • We need a way to read each Service Request number individually
  • We need to parse the input based on a delimiter

In my case I was getting the input in format as : 1-12345;1-34566;3-78686;9-09867
Multiple SR numbers separated by semicolon( ; ) as delimiter.

first i had to use Vanilla Business Service

BS : Inbound E-mail Manager 
Method : GetTokens

to parse input text and convert input string in multiple SR numbers.
For more information on this BS please refer bookshelf.
https://docs.oracle.com/cd/E14004_01/books/eMail/eMail_BusServMeth3.html

then, Iterate my code number of time and each time store the output in a variable, since the number of SR in input is not fixed i had to user arrays to dynamically store output.

Sample code looked like.
function Service_PreInvokeMethod(MethodName, Inputs, Outputs)
{
    if (MethodName == 'GetSRNumber')
     {
      var Result= new Array();
      var Status = "";
      var SRInput = Inputs.GetProperty("SRInput");
      var NumberOfSR = Inputs.GetProperty("NumberOfSR");
      var Token = "";
      var oService = TheApplication().GetService("Inbound E-mail Manager");                                    
      var oInputs = TheApplication().NewPropertySet();
      var oOutputs = TheApplication().NewPropertySet();

 // call BS to parse input to separate Numbers

      oInputs.SetProperty("Delimiter", ";");
      oInputs.SetProperty("NumTokens", NumberOfSR);
      oInputs.SetProperty("Text", SRInput);
      oService.InvokeMethod("GetTokens", oInputs, oOutputs);
      for(var x = 1; x <= NumberOfSR; x++)
      {
         Token = oOutputs.GetProperty('Token '+x);
        // Dynamically assign value in variable
          Result[x] = Token;
          Outputs.SetProperty('SR'+x,Result[x]);
      }
 }
 return (CancelOperation);
}


here, NumberOfSR is the count of SR's in Input which we require to separate to individual SR, Result is a array in which we are storing values of SR Number
expression Outputs.GetProperty('Token '+x) this expression iterates in the loop for each instance i.e. for x =1 it is evaluated as
 Outputs.GetProperty("Token 1")
and for subsequent values of x as
 Outputs.GetProperty("Token 2")
 Outputs.GetProperty("Token 3")
 Outputs.GetProperty("Token 4"), here we are dynamically creating the variable based in the number of times we need to run loop.

The same way we are dynamically assigning values in Array,
expression Result[x]  this expression iterates in the loop for each instance i.e. for x =1 it is evaluated as
Result[1] 
and for subsequent values of x as
Result[2] 
Result[3]
Result[4]  
.
The output of this is











we can then fetch the values of SR Number from output or we can use Property set to create Hierarchical outputs as well.

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


12 comments:

  1. Replies
    1. Great Article
      Cloud Computing Projects


      Networking Projects

      Final Year Projects for CSE


      JavaScript Training in Chennai

      JavaScript Training in Chennai

      The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

      Delete
  2. This is the first & best article to make me satisfied by presenting good content. I feel so happy and delighted.By Learn Digital Marketing Course Training in Chennai it will help to get Digital Marketing Course Training in Chennai.Learn Best Digital Marketing Course Training in Chennai's professional institute to get reputed job.

    ReplyDelete
  3. You are providing a post is very useful for develop my knowledge and I learn more info from your blog.
    Digital Marketing Course In Kolkata
    Web Design Course In Kolkata
    SEO Course In Kolkata

    ReplyDelete
  4. Great Article
    Cloud Computing Projects


    Networking Projects

    Final Year Projects for CSE


    JavaScript Training in Chennai

    JavaScript Training in Chennai

    The Angular Training covers a wide range of topics including Components, Angular Directives, Angular Services, Pipes, security fundamentals, Routing, and Angular programmability. The new Angular TRaining will lay the foundation you need to specialise in Single Page Application developer. Angular Training

    ReplyDelete
  5. Great Post! Thanks for your Share.


    Quality Onesie: Kigurumi Onesie Pajamas For Adults And Kids

    Qualityonesie offers Pikachu, Disney, Anime, Hello Kitty, Animals, Winnie the Pooh, Stitch, Unicorn Kigurumi Onesie Pajamas for Adults and Kids.

    ReplyDelete
  6. We have seen about 2 different instances of Reimage Plus Crack License Key incl Full Free Download.exe in different location. So far we haven't seen any License Key For Reimage

    ReplyDelete
  7. In this article, we will show you how to activate Windows with Windows 7 Ultimate Crack. Remember that buying Windows 7 keys on Microsoft's official site. Genuine Product Key For Windows 7 Ultimate

    ReplyDelete
  8. Don't worry about the gift for me on this Christmas. My dear sweet family in good health and great mood is everything I want to get. Because that's what I need .https://wishesquotz.com/christmas-wishes-for-loved-ones/

    ReplyDelete

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...