Help with Fileman identifiers needed.

159 views
Skip to first unread message

Kevin Toppenberg

unread,
Mar 16, 2023, 11:15:15 AM3/16/23
to Hardhats

Hey all, I have a simple file defined like this:

File: TMG ENCOUNTER DIAGNOSES                                        Branch: 1
REF  NODE;PIECE     FLD NUM  FIELD NAME
===============================================================================
  1  0;1                .01  SECTION NAME                              [RFJ60]
     1;0                  1  ENTRIES                        <-Mult [22753.01P]
  2   -0;1              .01   -DIAGNOSIS                      <-Pntr  [MMP80']
  3   -0;2              .02   -SEQUENCE                                [NJ8,2]
  4   -0;3              .03   -DISPLAY NAME                             [FJ64]
  5   -Computed   1   -DX NAME                                  [CJ64]
 <> <> <>

Each .01 field of the ENTRIES multiple is a pointer to the ICD diagnosis file.
Each 1 field is a computed expression that returns the external name of the code.

For example, if .01 = 'R07.9', then 1 would have computed value of 'Chest Pain, unspecified'

When displaying this record, I would like the 1 field to be also included as an identifier.

I have been looking at this page which seems to give instructions about identifying a field as an identifier: https://hardhats.org/fileman/u2/ut_id.htm

But I am not given an option to say YES as the instructions show.

Below is a listing of my attempt.

Can anyone help me here?

Thanks
Kevin

-------------------------------

Select VA FileMan Option: MODIFY FILE ATTributes
Do you want to use the screen-mode version? YES// NO

Modify what File: TMG ENCOUNTER DIAGNOSES//   (2 entries)



Select FIELD: ?
    Answer with FIELD NUMBER, or LABEL
   Choose from:
   .01          SECTION NAME
   1            ENTRIES  (multiple)

        You may enter a new FIELD, if you wish

Select FIELD: 1  ENTRIES  (multiple)
LABEL: ENTRIES//
READ ACCESS (OPTIONAL):
WRITE ACCESS (OPTIONAL):
SOURCE:
Select DESTINATION:
Select GROUP:
DESCRIPTION:
  Edit? NO//
TECHNICAL DESCRIPTION:
  Edit? NO//



Select ENTRIES SUB-FIELD: ?
    Answer with ENTRIES SUB-FIELD NUMBER, or LABEL
   Choose from:
   .01          DIAGNOSIS
   .02          SEQUENCE
   .03          DISPLAY NAME
   1            DX NAME

        You may enter a new ENTRIES SUB-FIELD, if you wish

Select ENTRIES SUB-FIELD: 1  DX NAME
LABEL: DX NAME//
TITLE:
READ ACCESS (OPTIONAL):
Select DESTINATION:
Select GROUP:
DESCRIPTION:
  Edit? NO//
TECHNICAL DESCRIPTION:
  Edit? NO//

DATA TYPE OF DX NAME: COMPUTED
'COMPUTED-FIELD' EXPRESSION: SET %=$P($G(^TMG(22753,D0,1,D1,0)),"^",1),X=$$VSTD^
ICDEX(%)  Replace
TYPE OF RESULT: STRING//
LENGTH OF FIELD: 64//




Select ENTRIES SUB-FIELD:

Sam Habiel

unread,
Mar 16, 2023, 11:48:24 AM3/16/23
to hard...@googlegroups.com
VEHU>S DUZ=1

VEHU>D P^DI


VA FileMan 22.2


Select OPTION: UTILITY FUNCTIONS
Select UTILITY OPTION: IDENTIFIER

Modify what File: STA
1 STAFFING DATA (2 entries)
2 STANDARD MEDICATION ROUTES (46 entries)
3 STANDARD POSITION (73 entries)
4 STANDARD REPORTS (15 entries)
5 STANDARD TERMINOLOGY VERSION FILE (1 entry)
Press <Enter> to see more, '^' to exit this list, OR
CHOOSE 1-5:
6 STANDARD VBECS DATA (150 entries)
7 STANDING ORDERS (14 entries)
8 STATE (85 entries)
9 STATION NUMBER (TIME SENSITIVE)
10 STATION ORDER (9 entries)
Press <Enter> to see more, '^' to exit this list, OR
CHOOSE 1-10: 8 STATE (85 entries)
Select FIELD: ?
Answer with FIELD NUMBER, or LABEL
Choose from:
.001 NUMBER
1 ABBREVIATION
2 VA STATE CODE
2.1 AAC RECOGNIZED
2.2 US STATE OR POSSESSION
3 COUNTY (multiple)
5 CAPITAL

Select FIELD: 5 CAPITAL
Want to make 'CAPITAL' an Identifier? No// Y (Yes)
Want to require that a value for 'CAPITAL' be asked
whenever a new 'STATE' is created? Yes// N (No)
Want to display 'CAPITAL' value whenever a lookup is done
on an entry in the 'STATE' File? Yes// (Yes)


Select UTILITY OPTION:




Select OPTION: INQUIRE TO FILE ENTRIES



Output from what File: STATE// (85 entries)
Select STATE NAME: ??

Choose from:
1 ALABAMA
2 ALASKA
4 ARIZONA
5 ARKANSAS
6 CALIFORNIA SACRAMENTO
8 COLORADO
9 CONNECTICUT HARTFORD
10 DELAWARE
11 DISTRICT OF COLUMBIA
12 FLORIDA TALLAHASSEE
13 GEORGIA
15 HAWAII
16 IDAHO
17 ILLINOIS
18 INDIANA
19 IOWA
20 KANSAS
21 KENTUCKY
22 LOUISIANA
> --
> --
> http://groups.google.com/group/Hardhats
> To unsubscribe, send email to Hardhats+u...@googlegroups.com
>
> ---
> You received this message because you are subscribed to the Google Groups "Hardhats" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to hardhats+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/hardhats/8bbf526b-3c8e-429d-9bad-d9390c4e6c33n%40googlegroups.com.

Kevin Toppenberg

unread,
Mar 16, 2023, 1:41:43 PM3/16/23
to Hardhats
Sam,

Thank you for this reply.  I see that I was looking in the wrong area.

I tried to follow these instructions, but it looks like a computed field can not be selected as an identifier.  So it looks like I can do what I was hoping for.

Thanks
Kevin

---------------------

Select Utility Functions Option: identifier


Modify what File: TMG ENCOUNTER DIAGNOSES//   (2 entries)
Select FIELD: ??

   Choose from:
   .02          SEQUENCE
   1            ENTRIES  (multiple)


Select FIELD: 1  ENTRIES  (multiple)
Select ENTRIES SUB-FIELD: ??

   Choose from:

   .02          SEQUENCE
   .03          DISPLAY NAME
   <------ NOTICE THAT MY COMPUTED FIELD, #1, IS NOT SHOWN.  NOT SELECTABLE.

Select ENTRIES SUB-FIELD:

Kevin Toppenberg

unread,
Mar 16, 2023, 1:45:19 PM3/16/23
to Hardhats
Oops, I meant I can NOT do what I was hoping for.

Kevin

Sam Habiel

unread,
Mar 16, 2023, 3:00:04 PM3/16/23
to hard...@googlegroups.com
You can set the "ID" node manually. I can't find where it is in the
manual right now. Showing you the patient file below:

VEHU>ZWRITE ^DD(2,0,"ID",*)
^DD(2,0,"ID",.02)="W """""
^DD(2,0,"ID",.03)="D EN^DDIOL($TR($$DOB^DPTLK1(Y,1),""/"",""-""),,""?$X+2"")"
^DD(2,0,"ID",.09)="D EN^DDIOL($$SSN^DPTLK1(Y),,""?$X+2"")"
^DD(2,0,"ID",.301)="W:$D(^(.3)) ""
"",@(""$P($P($C(59)_$S($D(^DD(2,.301,0)):$P(^(0),U,3),1:0)_$E(""_DIC_""Y,0),0),$C(59)_$P(^(.3),U,1)_"""":"""",2),$C(59),1)"")"
^DD(2,0,"ID",391)="S
%I=Y,Y=$S('$D(^(""TYPE"")):"""",$D(^DG(391,+$P(^(""TYPE""),U,1),0))#2:$P(^(0),U,1),1:""""),C=$P(^DD(391,.01,0),U,2)
D Y^DIQ:Y]"""" W "" "",Y,@(""$E(""_DIC_""%I,0),0)"") S Y=%I K %I"
^DD(2,0,"ID",404.01)="S
%I=Y,Y=$S('$D(^(""PC"")):"""",$D(^VA(200,+$P(^(""PC""),U,1),0))#2:$P(^(0),U,1),1:""""),C=$P(^DD(200,.01,0),U,2)
D Y^DIQ:Y]"""" W "" "",Y,@(""$E(""_DIC_""%I,0),0)"") S Y=%I K %I"
^DD(2,0,"ID",994)="I $$GET1^DIQ(2,Y_"","",994,""I"")=""Y"" D
EN^DDIOL($$GET1^DIQ(2,Y_"","",994),"""",""?$X+2"")"
^DD(2,0,"ID",1901)="W """""
^DD(2,0,"ID","AFJX NETWORK ID")="D
EN^DDIOL($$GET1^DIQ(2,Y_"","",537025),"""",""?0"")"
^DD(2,0,"ID","NETWORK ID")="W:$D(^(537025)) "" "",$P(^(537025),U,1)"
^DD(2,0,"ID","WRITE")="N X S X=$$OUTPTPR^SDUTL3(Y) D:X EN^DDIOL(""
""_$P(X,U,2),"""",""?2"") S X=$$OUTPTTM^SDUTL3(Y) D:X EN^DDIOL(""
""_$P(X,U,2),"""",""?2"")"
> To view this discussion on the web visit https://groups.google.com/d/msgid/hardhats/89f636dd-8066-4e4f-a1b2-cebc4b230c4bn%40googlegroups.com.

Kevin Toppenberg

unread,
Mar 16, 2023, 5:18:47 PM3/16/23
to Hardhats
lookas like they are discussed here:


I'll check it out.

Thanks

Kevin Toppenberg

unread,
Mar 16, 2023, 6:50:05 PM3/16/23
to Hardhats
OK, I have taken some time to look at this, and I guess I still don't understand.  Here is the documentation:

---------------------------------------------

Field Identifiers ^DD(filenumber,0,"ID",field)

Field Identifiers are defined using the FileMan Identifier option. The value at the node is a WRITE statement. If the identifier is to be used only to ask fields when a new entry is added, then the statement will only write null; otherwise, it will contain the code to write the external value of the field. An "I" is added to the second piece of the File Header when you add a field identifier, (as described in the "File Header" topic).

NOTE: WRITE statements in the FileMan-generated field identifier nodes are not executed when VA FileMan is in silent mode. Since FileMan generates the Field Identifier nodes, it knows their format. So in silent mode, FileMan places what would have been Written into an array instead for use by DBS calls. So Field Identifier nodes, although they contain WRITE statements, are compatible with GUI applications (in contrast to Write Identifier nodes).

---------------------------------------------

I specifically don't understand the sentence:

"If the identifier is to be used only to ask fields when a new entry is added, then the statement will only write null; otherwise, it will contain the code to write the external value of the field."

How is the identifier used when asking fields??  Is this only shown when prompting with a field name for input??

In my system, when I select a patient with ^DIC, I see some extra information about the record.  As below:

---------------------------------------------

yottadb>set DIC=2,DIC(0)="MAEQ" D ^DIC W Y,!

Select PATIENT NAME: ZZTEST,BAB,BABY  ZZTEST,BABY        9-19-09    109274297
  NO    74592^ZZTEST,BABY

yottadb>

---------------------------------------------

Here, I assume that "9-19-09    109274297   NO    74592^ZZTEST,BABY"  is coming from the identifiers", presumably the code that Sam linked earlier.  And this is done WITHOUT new entry. 


I tried making my own ID node for the 1 field (computed finding)

yottadb>zwr ^DD(22753.01,0,*)
^DD(22753.01,0)="ENTRIES SUB-FIELD^^1^4"
^DD(22753.01,0,"DT")=3230316
^DD(22753.01,0,"ID",1)="WRITE ""HELLO WORLD"",!"
^DD(22753.01,0,"IX","ASEQ",22753.01,.02)=""
^DD(22753.01,0,"IX","B",22753.01,.01)=""
^DD(22753.01,0,"NM","ENTRIES")=""
^DD(22753.01,0,"UP")=22753

But my Hello world doesn't show up.

---------------------------------------------

yottadb>DO P^DI
VA FileMan 22.2

Select OPTION: ENTER OR EDIT FILE ENTRIES
Input to what File: TMG ENCOUNTER DIAGNOSES//   (2 entries)
EDIT WHICH FIELD: ALL//

Select TMG ENCOUNTER DIAGNOSES SECTION NAME: CARDIOVASCULAR
SECTION NAME: CARDIOVASCULAR//
SEQUENCE: 1//
Select DIAGNOSIS: I63.50// ?
    Answer with ENTRIES DIAGNOSIS
   Choose from:
   I25.10
   I48.91
   I50.20
   I50.30
   I50.9
   I63.50
   I70.90
   I71.4
   I73.9
   R07.9

        You may enter a new ENTRIES, if you wish

 Answer with ICD DIAGNOSIS CODE NUMBER, or DESCRIPTION
 Do you want the entire 87356-Entry ICD DIAGNOSIS List? N  (No)
Select DIAGNOSIS: I63.50// R07.9

 One match found

     R07.9     Chest pain, unspecified

   OK?  Yes//   YES   R07.9     Chest pain, unspecified
  DIAGNOSIS: R07.9//

---------------------------------------------

When are identifier nodes executed?


Kevin

Kevin Toppenberg

unread,
Mar 16, 2023, 6:55:59 PM3/16/23
to Hardhats
I did add an "I" to the 2nd piece of the file header.  Since I am dealing with a field in a subfile, I'm not sure if there should be an I there as well.  But that would mean adding it to every multiple entry, and that doesn't seem right, so I did NOT add it there.

There was no change in the lookup behavior.  Still no "hello world"

Kevin

yottadb>ZWR ^TMG(22753,*)
^TMG(22753,0)="TMG ENCOUNTER DIAGNOSES^22753I^2^2"
^TMG(22753,1,0)="CARDIOVASCULAR^1"
^TMG(22753,1,1,0)="^22753.01P^10^10"
^TMG(22753,1,1,1,0)=508847
^TMG(22753,1,1,2,0)=508837
^TMG(22753,1,1,3,0)=508208
^TMG(22753,1,1,4,0)=508059
^TMG(22753,1,1,5,0)=508233
^TMG(22753,1,1,6,0)=508221
^TMG(22753,1,1,7,0)=508225
^TMG(22753,1,1,8,0)=521375
^TMG(22753,1,1,9,0)=508864
^TMG(22753,1,1,10,0)="508335^^CVA"
^TMG(22753,1,1,"B",508059,4)=""
^TMG(22753,1,1,"B",508208,3)=""
^TMG(22753,1,1,"B",508221,6)=""
^TMG(22753,1,1,"B",508225,7)=""
^TMG(22753,1,1,"B",508233,5)=""
^TMG(22753,1,1,"B",508335,10)=""
^TMG(22753,1,1,"B",508837,2)=""
^TMG(22753,1,1,"B",508847,1)=""
^TMG(22753,1,1,"B",508864,9)=""
^TMG(22753,1,1,"B",521375,8)=""
^TMG(22753,2,0)="MUSCULOSKELETAL (MSK)^2"
^TMG(22753,2,1,0)="^22753.01P^12^12"

Sam Habiel

unread,
Mar 17, 2023, 10:15:38 AM3/17/23
to hard...@googlegroups.com
I tried this and it worked for me.

VEHU>zwrite ^DD(999001,0,"ID",*)
^DD(999001,0,"ID",2)="D EN^DDIOL($$NOW^XLFDT)"

VEHU>ZWRITE ^DIZ(999001,*)
^DIZ(999001,0)="SAM'S FILE^999001I^1^1"
^DIZ(999001,1,0)="ENTRY 1^ID 1"
^DIZ(999001,"B","ENTRY 1",1)=""

VEHU>set DIC=999001,DIC(0)="MAEQ" D ^DIC W Y,!

Select SAM'S FILE NAME: `1 ENTRY 1
3230317.1411371^ENTRY 1

VEHU>set DIC=999001,DIC(0)="MAEQ" D ^DIC W Y,!

Select SAM'S FILE NAME: `1 ENTRY 1
3230317.1411371^ENTRY 1

If you want to debug, DIC("W") is set at W^DIC1 with the identifiers
(presumably after it finds an "I" in the file DATA header), and my
stack at NOW^XLFDT looks like this:

NOW^XLFDT (ZBREAK)
(Direct mode)
Indirection
WO+6^DIC2
WO+3^DIC2
GOT+1^DIC2
GOT^DIC2
BYIEN1+4^DIC5
GRV^DIC
+1^GTM$DMOD (Direct mode)

--Sam
> To view this discussion on the web visit https://groups.google.com/d/msgid/hardhats/5ce021a1-1b17-4f93-a215-cc7de192e913n%40googlegroups.com.

Kevin Toppenberg

unread,
Mar 18, 2023, 6:14:48 PM3/18/23
to Hardhats
I've finally gotten to work on this.  I think I am seeing the problem.  Below is the definition of my file.  I have a subfile "ENTRIES", and the .01 field is a pointer to file 80 (ICD DIAGNOSIS).

File: TMG ENCOUNTER DIAGNOSES                                        Branch: 1
REF  NODE;PIECE     FLD NUM  FIELD NAME
===============================================================================
  1  0;1                .01  SECTION NAME                              [RFJ60]
  2  0;2                .02  SEQUENCE                                  [NJ9,2]

     1;0                  1  ENTRIES                        <-Mult [22753.01P]
  3   -0;1              .01   -DIAGNOSIS                      <-Pntr  [MMP80']
  4   -0;2              .02   -SEQUENCE                                [NJ8,2]
  5   -0;3              .03   -DISPLAY NAME                             [FJ64]
  6   -Computed           1   -DX NAME                                  [CJ64]
 <> <> <>

When I put a breakpoint at W^DIC, and even add other breakpoints upstream from this, I see that it loads up identifiers from the **pointed-to file**, i.e. identifiers for file 80, not identifiers for the subfile 22753.01.

Here is the code from W^DIC1

>+52W F  S %=$O(^DD(+DO(2),0,"ID",%)) D:%]""  Q:%=""
 +53 . N X S X=^DD(+DO(2),0,"ID",%) Q:X="W """""
 +54 . I $L(DIC("W"))+$L(X)>224 D WOV S %="" Q
 +55 . I DIC("W")="" S DIC("W")="N C,DINAME"
 +56 . S DIC("W")=DIC("W")_" W ""  "" "_X
 +57 . Q
 +58 Q

The relevant input parameter is DO, which contains the following information:

DO=ICD DIAGNOSIS^80IO^571831^87356
}~2 = 80IO
---

I have thought about trying to find out WHY it is doing this, and what the consequences would be if it used the identifiers from my file TMG ENCOUNTER DIAGNOSES instead.  But ultimately, I don't want to try to modify Fileman at this point and I will work with it as it is.

I'll experiment with putting the identifiers into file 80.

Thanks
Kevin

Kevin Toppenberg

unread,
Mar 18, 2023, 6:23:49 PM3/18/23
to Hardhats
Actually, it looks like file 80 already has identifiers.

  1) ^DD(80,0,"ID",1.1) = D EN^DDIOL((" "_$$IDDXF^ICDID(+Y)),"","?0")
 <> <> <>

But they don't seem to be used when I want them to be.  For example (see <--- in text below):


yottadb>do P^DI
VA FileMan 22.2
Select OPTION: enter OR EDIT FILE ENTRIES
Input to what File: ICD DIAGNOSIS// tmg encOUNTER DIAGNOSES
                                          (18 entries)
EDIT WHICH FIELD: ALL//

Select TMG ENCOUNTER DIAGNOSES SECTION NAME: Cardiology / Vascular
SECTION NAME: Cardiology / Vascular  Replace
SEQUENCE: 1//
Select DIAGNOSIS: I25.2// I25.2

 One match found

     I25.2     Old myocardial infarction  <--------------- this seems to be using the identifier

   OK?  Yes//   YES   I25.2     Old myocardial infarction
  DIAGNOSIS: I25.2//
  SEQUENCE:
  DISPLAY NAME:
Select DIAGNOSIS: ??

   Choose from:
   G45.9   <------ but identifier is not used here.  What is code G45.9?? I want to see it's name....
   I10.
   I11.0
   I11.9
   I12.0
   I12.9
   I13.0
   I13.10
   I21.3
   I25.10
   I25.110
   I25.2

   I48.91
   I50.20
   I50.30
   I50.9
   I63.50
   I65.29
   I70.90
   Type <Enter> to continue or '^' to exit:


Is it possible to get additional information to display instead of just the codes above??

Thanks
Kevin

Sam Habiel

unread,
Mar 20, 2023, 10:05:36 AM3/20/23
to hard...@googlegroups.com
Lexicon files and Patient file use a Special Look-up program. In the
words of Dante the gates of hell say, "Abandon all hope ye who enter
here".

It has been my experience that Special Look-up programs do not
completely honor all of Fileman's rules. Apparently you are running
into that.

A Special Look-up program is a custom program (set in ^DD(n,0,"DIC")
node) that does look-ups on behalf of Fileman. I have never seen any
documentation on how to write one. They are quite rare:

VEHU>zwrite ^DD(:,0,"DIC")
^DD(2,0,"DIC")="DPTLK"
^DD(80,0,"DIC")="ICDEXLK"
^DD(80.1,0,"DIC")="ICDEXLK"
^DD(211.4,0,"DIC")="NURSAFLL"
^DD(757.01,0,"DIC")="LEXA1"
^DD(9000001,0,"DIC")="DPTLK"

You can modify the look-up programs if you want. They are patched via
KIDS, so you have to keep track of your changes.

--Sam
> To view this discussion on the web visit https://groups.google.com/d/msgid/hardhats/06223439-61e9-4efd-9cd9-4ef740e2a336n%40googlegroups.com.

Kevin Toppenberg

unread,
Mar 28, 2023, 6:04:56 PM3/28/23
to Hardhats

As per the other thread, I have been working on selecting TIU DOCUMENT records in reverse chronological order.  Got that done. 

Now I would like to make the display of records more rationale.  See below.
============================================================

yottadb>K DIC SET DIC=8925,DIC(0)="MAEQ" DO ^DIC

Select TIU DOCUMENT PATIENT: ZZTEST,BABY
    EPISODE BEGIN DATE/TIME:

ZZTEST,BABY                                F 09/19/2009 109274297      109010103
P
                                                                        10901010
3P
     1   ZZTEST,BABY  MAR 07, 2023@16:44:50  DEATH NOTE     ZZTEST,BABY     03-0
7-23     TITLE
      Std Title: SUMMARY OF DEATH NOTE
     2   ZZTEST,BABY  MAR 07, 2023@16:44:50  DEATH NOTE     ZZTEST,BABY     03-0
7-23     TITLE
      Std Title: SUMMARY OF DEATH NOTE
     3   ZZTEST,BABY  MAR 07, 2023@16:44:50  HOSPITAL D/C SUMM (IMAGE)     ZZTES
T,BABY     03-07-23     TITLE
      Std Title: DISCHARGE SUMMARY
     4   ZZTEST,BABY  MAR 06, 2023@16:34:16  ACUTE MEDICAL ISSUE VISIT     ZZTES
T,BABY     03-06-23     TITLE
      Std Title: E & M CLINICAL NOTE
     5   ZZTEST,BABY  MAR 02, 2023@18:25:27  ACUTE MEDICAL ISSUE VISIT     ZZTES
T,BABY     03-02-23     TITLE
      Std Title: E & M CLINICAL NOTE

Press <Enter> to see more, '^' to exit this list,  OR
CHOOSE 1-5:


============================================================
Let's look at 1 possible record:

     1   ZZTEST,BABY  MAR 07, 2023@16:44:50  DEATH NOTE     ZZTEST,BABY     03-0
7-23     TITLE
      Std Title: SUMMARY OF DEATH NOTE


Notice that it has the patient's name twice, a date twice, in two different formats, and the title of the note in 2 different formats.

Where is this coming from?  Are these identifiers?

Here are the identifiers that I see for 8925.  But I don't see how it would output the above.

yottadb>zwr ^DD(8925,0,"ID",*)
^DD(8925,0,"ID",.02)="S %I=Y,Y=$S('$D(^(0)):"""",$D(^DPT(+$P(^(0),U,2),0))#2:$P(
^(0),U,1),1:""""),C=$P(^DD(2,.01,0),U,2) D Y^DIQ:Y]"""" W ""   "",Y,@(""$E(""_DI

C_""%I,0),0)"") S Y=%I K %I"
^DD(8925,0,"ID",.07)="W ""   "",$E($P(^(0),U,7),4,5)_""-""_$E($P(^(0),U,7),6,7)_
""-""_$E($P(^(0),U,7),2,3)"


What is it that defines the record display output?

Thanks
Kevin

Sam Habiel

unread,
Mar 29, 2023, 10:13:01 AM3/29/23
to hard...@googlegroups.com
Okay. This one is a doozy, because the last entry there was quite
mysterious on how it showed up.

So I will label the fields:
1. ZZTEST,BABY
2. MAR 07, 2023@16:44:50
3. DEATH NOTE
4. ZZTEST,BABY
5. 03-07-23
6. TITLE
7. Std Title: SUMMARY OF DEATH NOTE

IDs:
^DD(8925,0,"ID",.02)="S
%I=Y,Y=$S('$D(^(0)):"""",$D(^DPT(+$P(^(0),U,2),0))#2:$P(^(0),U,1),1:""""),C=$P(^DD(2,.01,0),U,2)
D Y^DIQ:Y]"""" W "" "",Y,@(""$E(""_DIC_""%I,0),0)"") S Y=%I K %I"
^DD(8925,0,"ID",.07)="W ""
"",$E($P(^(0),U,7),4,5)_""-""_$E($P(^(0),U,7),6,7)_""-""_$E($P(^(0),U,7),2,3)"

A New Style Index prints out its values upon lookup: That's why you see 1 & 2.

3 is the .01 field.

4 comes from the ID .02 for .02 It apparently prints something else
too ($E(^TIU(8925,something)), but I don't see that output.

5 is the .07. Looks like the note date.

I can't figure out where 6 and 7 come from right now.

--Sam
> To view this discussion on the web visit https://groups.google.com/d/msgid/hardhats/a6ac9392-c91f-4d85-8c12-537cb51d1d22n%40googlegroups.com.

Kevin Toppenberg

unread,
Mar 30, 2023, 8:51:38 AM3/30/23
to Hardhats
Sam,

Thank you for looking at this.  As per the other thread, I am having to fall back to the old "B" index, so this won't be an immediate issue for us anymore.

I guess what I really wanted to know, is whether all the output it coming from the code you show above, or is it coming from somewhere else.    It is difficult to debug such code since I can't set a break-point there and see the values of all those variables.

Kevin

Greg Kreis

unread,
Apr 3, 2023, 11:11:57 AM4/3/23
to hard...@googlegroups.com

This code ....@(""$E(""_DIC_""%I,0),0)"")...  resets the naked reference. Why? Because the ID code for field .07 is next to be executed. So what? Each ID node's code is supposed to be written presuming the naked reference is at the ^(0) node of the record being processed in the original file (8925). Since the ID code for field .02 is navigating with a pointer to file 2 the naked reference has been moved. Writing the zeroth character of the node outputs nothing BUT it references the original node to do the reset. Nifty trick that FM does, but it illustrates the potential pitfalls awaiting those who write custom ID code.

George Timson

unread,
Apr 3, 2023, 5:00:51 PM4/3/23
to Hardhats

I wrote the code that creates that @(""$E(""_DIC_""%I,0),0)"")!  Am I ashamed of @(""$E(""_DIC_""%I,0),0)"")?  No I am not. 

And if it was GPT, not Greg Kreis, that figured out what @(""$E(""_DIC_""%I,0),0)"") is doing, then I am ready to cede it mastery of the Universe!

--George Timson



Kevin Toppenberg

unread,
Apr 8, 2023, 9:34:01 AM4/8/23
to Hardhats
I hate to be that guy, but I'm going to use this as an example of a core problem with VistA.  It is too 'expert friendly' (Thanks Bhaskar to introducing me to this wonderful phrase!).  There are too many "tricks" like this that not widely understood.  Keeping track of the naked reference value may have provided a vital performance boost in the past, when computers were slower.  But now it just seems like a liability.  Greg wrote "Each ID node's code is supposed to be written presuming the naked reference is at the ^(0) node of the record being processed in the original file (8925).".   And he figured out that "@(""$E(""_DIC_""%I,0),0)"")" is there reset the naked reference.  He doesn't say where he found this code.  I am assuming it is found in identifier code, which would imply that a poorly written identifier can break someone else's identifier.  But when I look at this documentation: https://www.hardhats.org/fileman/pm/gfs_3a.htm,  "In your M code for each write identifier node, you can refer to the following values which will be defined at the time the node is executed: Y - Current record number  //  Naked Reference - Set to the 0-node of the entry"It doesn't say anything about the user being responsible for resetting the naked reference.  It is possible that I have missed a key sentence setting out the proper rules.  But the point remains that much of Vista core is arcane and difficult, and the number of people that properly understand it is small and diminishing.  I am a part-time programmer, and have never had formal computer science education.  So perhaps I am perceiving this all as more difficult than it is.  But all this just seems "clever", and clever is often bad for continued understanding with subsequent generations of programmers.

UPDATE: As I have read this back, I now suspect that the code Greg has listed, "@(""$E(""_DIC_""%I,0),0)"")", is found inside Fileman, and not expected from user's code.  If so, then I am more accepting of it.  If I were to look inside .dll's from Windows, I suspect they also have clever programming tricks to enhance performance.  And as long as they work and other's don't have to understand them, then it is OK.  It does mean, however, that there will have to be ongoing deep understanding of mumps and Fileman tricks to support the code, and likewise a continuing source of new skilled mumps system programmers able to carry the torch. 

Background: I'm a bit grumpy this week as I have been trying to debug through the programming logic in CPRS for dealing with encounter data (patient-care-encounter data).  It has an unsatisfactory reliance of globally scoped variables, and little documentation as to intent etc.  So sorry if this is bleeding through. LOL!

Kevin
Reply all
Reply to author
Forward
0 new messages