Passing fields into xlt proc

Homepage Clovertech Forums Cloverleaf Passing fields into xlt proc

  • Creator
    Topic
  • #119141
    Jason Russell
    Participant

    I’m trying to pass an entire field (PID-3 to be specific) into a TCL proc via an XLT copy method. My biggest issue is I want to pass the entire field (including all repeats) into the proc to do some work with it, and send back out the correct name values. Is there a way to accomplish this, or am I going to have to do the work before the XLT?

Viewing 7 reply threads
  • Author
    Replies
    • #119142
      Jim Kosloskey
      Participant

      ITERATE over the field and apply your proc at each repetition for the name components. May not even need TCL depending on what you are trying to accomplish.

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

    • #119144
      Jason Russell
      Participant

      I suppose that’s going to be the ‘best’ way, was attempting to filter out all but certain Assigning Authorities, and keep that in a centralized location. So we could have (In PID 3):

      1234^^^A^~2345^^^B^~3456^^^C

      In some cases we’d want A, some we’d want B, and sometimes both. I’m coming from the standpoint of attempting to keep everything as centralized as possible so if there is a change, we only change it a few times rather than on every single interface.

    • #119145
      Jim Kosloskey
      Participant

      Well you have options. I am on the road now but if you email me with your tel # we can chat and cover options as I see them.

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

    • #119146
      Charlie Bursell
      Participant

      This may not be as elegant as you like but if you want all iterations in one place you could do something like:

      { { OP COPY }
      { ERR 0 }
      { PRE {
      set fldList “”
      }}
      { IN @null }
      { OUT @null }
      }
      { { OP ITERATE }
      { BASIS 0(0).PID(0).#3 }
      { VAR %f1 }
      { TYPE field }
      { BODY {
      { { OP COPY }
      { ERR 0 }
      { PRE {
      lappend fldList $xlateInVals
      }}
      { IN 0(0).PID(0).#3(%f1) }
      { OUT @null }
      }
      }}
      }
      { { OP COPY }
      { ERR 0 }
      { PRE {
      foreach fld $fldList {echo $fld}
      }}
      { IN @null }
      { OUT @null }
      }

      The output of the last echo  statement, used for demo only, is:

      1234 {} {} A {}
      2345 {} {} B {}
      3456 {} {} C

      Note you need to init the variable since all variables in Xlate are global.

    • #119148
      Anonymous
      Inactive

      We have a few xlt.tcl procs that accept the literal path as a parameter.

      For example the source input is:

      =1(0).0(0).PV1.#7  (note the leading “=”)

      The xlt.tcl uses xpmfetch for access to that path. This is the main part:

      proc xltFormatIdName {} {
      upvar xlateId xlateId \
      lassign $xlateInVals path
      for {set i 0} {$i < 1000} {incr i} {
      set datumLst [xpmfetch -warn w $xlateId $path\($i\)]

      In this example datumLst gives you the entire contents of PV1:7. I didn’t write this proc, but I’ve used it many times.

       

    • #119149
      Jason Russell
      Participant

      Thank you all for your responses! David, yours might just be what I’m looking for, I’ll play with it a bit and respond back!

    • #119154
      Jason Russell
      Participant

      Is there any documentation on xpmfetch?

    • #119155
      Jim Kosloskey
      Participant

      It is in the provided doc under XPM Functions I believe.

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

Viewing 7 reply threads
  • You must be logged in to reply to this topic.

Forum Statistics

Registered Users
5,119
Forums
28
Topics
9,293
Replies
34,435
Topic Tags
286
Empty Topic Tags
10