Another good response, Joseph! Using the subroutine allows it to be generalized where the second argument can be any attribute and the first "1" can be which sub-value you need, e.g., 1, 2, 3, etc. Since the dictionary is built in a specific file, the subroutine can be agnostic as to which file, the dictionary processor supplies it.
An aside, I found out recently that using I-type dictionaries in Retrieve supplies the "@FILENAME" parameter but using "ITYPE" in UniVerse Basic requires that the user set that variable before executing the "ITYPE" function. If it's not supplied, the results are different between Retrieve and Basic.
------------------------------
Jeff Teter
Woodforest National Bank
The Woodlands, TX
------------------------------
Original Message:
Sent: 12-01-2022 09:02
From: Joseph von Arx
Subject: Extracting specific subvalues
The reason the conversion is necessary is because the FIELDS function operates using the standard delimiters which include the Subvalue mark. The way you are currently doing this is correct and how we have done on our system. That being said, I have also experimented and created a routine that would allow me this syntax.
SUBR('FieldSF', @RECORD<77>, @VM, @SM, 1, 1)
To me that makes it clearer and more maintainable, but unless you want to create your own routine, you would need to continue doing the conversion within the dictionary.
------------------------------
Joseph von Arx
President
Data Management Associates Inc DMA
Cincinnati OH US
Original Message:
Sent: 11-30-2022 16:27
From: Jeff Teter
Subject: Extracting specific subvalues
We have data that is stored in an attribute with multiple values and up to two sub-values per value. Using an I-type dictionary, I have found that I can only extract specific sub-values if any sub-value marks are converted to another character first.
For instance, the following will not work for attribute 2 (formula) in the dictionary to retrieve the first sub-value:
FIELDS( @RECORD<77>, @SM, 1, 1 )
Instead, we have resorted to using the following:
CONVERT( @SM, "`", @RECORD<77> ); FIELDS( @1, "`", 1, 1 )
Just curious if this is an expected behavior or if anyone has found a more elegant solution.
Thanks!
------------------------------
Jeff Teter
Woodforest National Bank
The Woodlands, TX
------------------------------