Dynamic field resolusion in Xlate

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Dynamic field resolusion in Xlate

  • Creator
    Topic
  • #50939
    Alex Puzikov
    Participant

    Hi all.

    I know it is far fetched but I would like to hear if any one tried something like this.

    Problem at hand:

    key/value pairs coming in incoming OBX message.

    I have a lookup table to identify a key and returning fieldNumber for my Z segment.

    I know that conventional metod to do next step is, to create an if statment and then store value.

    Which is a big issue if you can recieve large number key/value pairs

    Question:

    Is any one managed to dynamicaly generate a destination field in Xlate that was derived from variable?

    key|value


    color|red

    shape|circle

    location|aruba

    table mapping


    color     -> 1

    location -> 2

    shape    -> 3

    result should store

    color value in ZF.#1.[0]

    location value in ZF.#2.[0]

    shape value in ZF.#3.[0]

    { OP COPY }

                                       { ERR 0 }

                                       { IN @value }

                                       { OUT {{0(0).ZF.#@retval.[0]}} }

    Thanks.

    Alex

Viewing 0 reply threads
  • Author
    Replies
    • #68116
      Jim Kosloskey
      Participant

      Alex,

      Not knowing all the details I offer this:

      Make your Z segment field repeating rather than multiple fields, then take the number (base it on zero) from the Table lookup and populate your own iteration counter (field level) and use that counter in the COPY Action for the outbound Z segment field repeition. In my mind, this is an elegant solution and there is no hideen activity. Be sure to comment liberally.

      The other option is to write a Tcl proc using xmpstore. You can change virtually anything in the XlatOutList (where the address path of the Outbound field exists).

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

Viewing 0 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,296
Replies
34,439
Topic Tags
287
Empty Topic Tags
10