Rocket U2 | UniVerse & UniData

 View Only
  • 1.  I-type dictionary for first subvalue

    Posted 07-15-2021 12:02
    I'll claim a senior moment here... An associate is trying to write an I-type dictionary that retrieves the first subvalue in a set of  fields. I can certainly do it with a subroutine and the FIELD function, but the FIELDS function specifically excludes use of the value mark or sub-value mark as delimiters. Suggestons? I'm sure it will be a forehead slapper when presented...

    The existing data is:
    ABC@SVMDEF@VMGHI@SVMZBA@VMQAR

    He wants it to return:
    ABC@VMGHI@VMQAR

    Thanks, in advance!

    ------------------------------
    Jeff Teter
    Woodforest National Bank
    The Woodlands, TX
    ------------------------------


  • 2.  RE: I-type dictionary for first subvalue

    PARTNER
    Posted 07-16-2021 07:49
    Hi Jeff,

    The multi-value subroutines act on each system-delimiter delimited "piece" (i.e. value, sub-value).  In order to use FIELDS, you need to get rid of the sub-value marks so that FIELDS can work down to only the value-level.  Depending on how you write your I-Types, it would be
    FIELDS(COVERT(@SM,"|",[whatever the larger thing is called]),"|",1,1)
    -or-
    ...;CONVERT(@SM,"|",@);FIELDS(@,"|",1,1)

    Of course the | can't be part of the data.  Use whatever character works for the data.

    I hope that helps.
    Tyrel

    ------------------------------
    Tyrel Marak
    Technical Support Manager
    Aptron Corporation
    Florham Park NJ United States
    ------------------------------



  • 3.  RE: I-type dictionary for first subvalue

    PARTNER
    Posted 07-16-2021 12:00
    There are several ways to do it but the simplest could be this:
    0001 I
    0002 @RECORD<1,1,1>:'*':@RECORD<1,1,3>:'*':@RECORD<1,1,5>
    0003
    0004 AUDITSTUFF
    0005 20L
    0006 S

    ------------------------------
    Bill Henson
    Special Ops
    Vertafore Inc
    Bothell WA United States
    ------------------------------