.offsize$ question
#32221
24 Jan 20 05:17 PM
|
Joined: Sep 2002
Posts: 5,450
Frank
OP
Member
|
OP
Member
Joined: Sep 2002
Posts: 5,450 |
Good day -
I have a structure with an array. I am having trouble adding this arrayed variable to a coldef using the .offsize$ syntax. Any clue how it would be formatted? I tried adding extra "" before and after the array but can't seem to get it to compile.
I know the following isn't correct but its an example of what im playing with. TIA
MAP2 X'ICD10(12) MAP3 C'ICD10,S,1 MAP3 ICD10,S,10
FOR I=1 TO 8 X'COLDEF += .offsiz$(XPOST.X'ICD10(I))+ "~ICD10~SBEX~Dspmin=3~~" NEXT I
|
|
|
Re: .offsize$ question
[Re: Frank]
#32222
24 Jan 20 05:54 PM
|
Joined: Jun 2001
Posts: 11,650
Jack McGregor
Member
|
Member
Joined: Jun 2001
Posts: 11,650 |
Congratulations, you've just hit the edge of the envelope on this particular feature. Hard to believe that no one else has run into this yet, but it appears to be the case that the .OFFSIZ$(var) mechanism doesn't support referencing array elements. It probably should be enhanced accordingly, but for your immediate need, you're going to have to either revert to manually calculating the offsets, or manually mapping out the array elements as individual scalars, e.g.
MAP2 C'ICD10'1,S,1 ! X'ICD10(1)
MAP2 ICD10'1,S,10
MAP2 C'ICD10'2,S,1 ! X'ICD10(2)
MAP2 ICD10'2,S,10
...
Admittedly, kind of tedious and retro, but on the other hand, you have to define each column in the XTREE coldef individually anyway, so it's consistent and parallel in that respect.
|
|
|
Re: .offsize$ question
[Re: Frank]
#32223
24 Jan 20 06:08 PM
|
Joined: Sep 2003
Posts: 4,135
Steve - Caliq
Member
|
Member
Joined: Sep 2003
Posts: 4,135 |
Think others have I just kind of cheat on the lines of:
MAP2 XSTOCK'UD'START,S,1
MAP2 XSTOCK'UD'COL(11)
MAP3 XSTOCK'UD'BGC,S,1
MAP3 XSTOCK'UD,S,12
then using the pseudo XSTOCK'UD'START (whats not used for anything else) we know where to start and then just loop..
LOCAL'POS=.OFFSIZ$(XT'XTREE'ELEMENT.XSTOCK'UD'START)
LOCAL'POS=LOCAL'POS+1
FOR LOCAL'I=1 TO 11
XT'COLDEF$ += STR(LOCAL'POS)+"~13~"+LOCAL'CAPTION+CHR(13)+LOCAL'CAPTION2+"~B#>"+LOCAL'HIDE+"~~"
LOCAL'POS=LOCAL'POS+13
NEXT LOCAL'I
|
|
|
Re: .offsize$ question
[Re: Frank]
#32224
24 Jan 20 06:09 PM
|
Joined: Sep 2002
Posts: 5,450
Frank
OP
Member
|
OP
Member
Joined: Sep 2002
Posts: 5,450 |
AHHHH!!!!! Too late i am in too deep!!!! I will break out the variable names... thanks for the info. PS: thanks for the cheat Steve
Last edited by Frank; 24 Jan 20 06:21 PM.
|
|
|
Re: .offsize$ question
[Re: Frank]
#32225
24 Jan 20 08:06 PM
|
Joined: Sep 2002
Posts: 5,450
Frank
OP
Member
|
OP
Member
Joined: Sep 2002
Posts: 5,450 |
Is it even possible to assign the value of the .offsize$ command to a variable? If i try Steve's hack i just get 0 which sort of makes sense since the returned value is formatted like 10~2. With that being said i don't know how Steve's example works
Last edited by Frank; 24 Jan 20 08:08 PM.
|
|
|
Re: .offsize$ question
[Re: Frank]
#32226
24 Jan 20 08:13 PM
|
Joined: Sep 2003
Posts: 4,135
Steve - Caliq
Member
|
Member
Joined: Sep 2003
Posts: 4,135 |
In my example the following just sets the position XSTOCK'UD'START in the structure, LOCAL’POS is mapped as a F,6 LOCAL'POS=.OFFSIZ$(XT'XTREE'ELEMENT.XSTOCK'UD'START)
|
|
|
Re: .offsize$ question
[Re: Frank]
#32227
24 Jan 20 08:15 PM
|
Joined: Sep 2002
Posts: 5,450
Frank
OP
Member
|
OP
Member
Joined: Sep 2002
Posts: 5,450 |
Right - i tried similar and i just get 0 as a value... which makes sense since .offsize$ is formatted for output like start~len... so not sure why working for you!
|
|
|
Re: .offsize$ question
[Re: Frank]
#32228
24 Jan 20 08:18 PM
|
Joined: Sep 2003
Posts: 4,135
Steve - Caliq
Member
|
Member
Joined: Sep 2003
Posts: 4,135 |
Oh strange I’ve done it like that in many programs (maybe multiple Magic’s spells?) or unforeseen luck that may bite me in the bum someday?
|
|
|
Re: .offsize$ question
[Re: Frank]
#32229
24 Jan 20 08:23 PM
|
Joined: Sep 2002
Posts: 5,450
Frank
OP
Member
|
OP
Member
Joined: Sep 2002
Posts: 5,450 |
LOL or i am just doing it wrong in my test! - welp you are right i had something backwards in my test so cheers!
|
|
|
Re: .offsize$ question
[Re: Frank]
#32230
24 Jan 20 08:24 PM
|
Joined: Sep 2003
Posts: 4,135
Steve - Caliq
Member
|
Member
Joined: Sep 2003
Posts: 4,135 |
|
|
|
Re: .offsize$ question
[Re: Frank]
#32232
24 Jan 20 10:27 PM
|
Joined: Jun 2001
Posts: 11,650
Jack McGregor
Member
|
Member
Joined: Jun 2001
Posts: 11,650 |
Note that when taking the value of a string expression, either implicitly (via assignment to a numeric variable) or explicitly (using the val(0 function), the operation works up until the first non-numeric character. So for an .OFFSIZ() expression of the form "23~15" the value would be 23.
|
|
|
Re: .offsize$ question
[Re: Frank]
#32233
24 Jan 20 10:28 PM
|
Joined: Sep 2002
Posts: 5,450
Frank
OP
Member
|
OP
Member
Joined: Sep 2002
Posts: 5,450 |
Gotit and Steve's hack is a good workaround
|
|
|
|
|