Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

ITM/IMAS releases of Kepler provide two, built from scratch, actors for record manipulation.

1. Setting values inside Record Token using recordset actor

recordset actor allows you to set/modify values inside Record Token. It works following way:

  1. If there is no field inside Record Token, it will add it into Record Token

    Code Block
    { a = 1 } -> inputRecord -+
                              |
                               >- { a = 1, b = 2 }
                              |
    2         -> b           -+                    // I am passing value 2 into port with the name b - new 
                                                   // entry inside record will be created
  2. If there is a field with given name inside Record Token, it will be replaced

    Code Block
    { a = 1, b = 1 } -> inputRecord -+
                                     |
                                      >- { a = 1, b = 2 }
                                     |
    2                -> b           -+             // I am passing value 2 into port with the name b - old 
                                                   // value will be replaced with new one
  3. If there is a field with given name inside Record Token, the type of field may change if you pass different type in the input

     

    Code Block
    { a = 1, b = 1 }  -> inputRecord -+
                                      |
                                       >- { a = 1, b = { c = 2 } }
                                      |
    { c = 2 }         -> b           -+            // I am passing record { c = 2 } into port b - old value 
                                                   // will be replaced with Record Token element (nested Record Token)
  4. You can modify nested Record Type values by separating names of elements with /. E.g. you can specify "a/b"

    Code Block
    { a = { b = 1} }  -> inputRecord -+
                                      |
                                       >- { a = 1,{ b = { c = 2 } }
                                      |
    2                 -> a/b         -+            // I am passing value 2 into port a/b - this time, I modify element a.b inside Record Token
                                                   // note that we have to use "/" in port name due to the fact Kepler 
                                                   // doesn't allow to use "." as name separator

 

 

Image Removed

recordget

 

This actor allows to get values from the RecordToken

Image Added

2. Getting values from Record Token using recordget actor

recordget actor allows you to retrieve values from Record Token. Comparing to expressions, you can:

  • get the whole Record Token as it is (e.g. to pass it further) via "//" port
  • you can get multiple fields at the same time by specifying their names using output ports
  • you can get nested values directly from the Record Token
  1. Getting single value from recordget can be done by specifying element's name as output port

    Code Block
                                      +- // -> { a = 1, b = 1 }       // you can always get original record via "//" port
                                      |
    { a = 1, b = 2 }  -> inputRecord -+
                                      |
                                      +- b  -> 2                      // we get value of element "b"
    
  2. Getting multiple values can be done by specifying multiple names

    Code Block
                                      +- // -> { a = 1, b = 1 }       // you can always get original record via "//" port
                                      |
    { a = 1, b = 2 }  -> inputRecord -+- a  -> 1                      // this time, we get also value of element "a"
                                      |
                                      +- b  -> 2                      // we get value of element "b"
  3. You can use nested names to get values from the nested parts of Record Token

    Code Block
                                              +- //   -> { a = 1, b = { c = 3 } }       // you can always get original record via "//" port
                                              |
    { a = 1, b = { c = 3 } }  -> inputRecord -+- a    -> 1                              // this time, we get also value of element "a"
                                              |
                                              +- b    -> { c = 3 }                      // this time, we get a record from b
                                              |
                                              +- b/c  -> 3                              // and here, we are accessing element b.c by specifying full path
                                                                                        // to nested element

 

Image Added

3. Generating empty Record Token

In Kepler you have two ways of generating Record Token. You can use either Record Assembler (with empty input) or Constant actor with "emptyRecord()" value inside

Image Added

4. Sample workflows

You can download sample workflows here:

 

 

 

 Image Removed