Re: [Hardhats-members] Trouble setting up FDA

2004-11-24 Thread Greg Woodhouse
I guess that one code snippet is pretty cryptic. Here's my whole
function BLDFDA. This is a step in copying the (parsed) contents of an
HL7 message to Fileman.


BLDFDA(CSLQD,CSLROOT)   ;
N MYFDA,I,II,J,K,BASE,MYIENS,FLD,IENS,BIENS,VAL,SFILE,CNT
N LAST,RSFILE,MYIENS1,FLD1,VAL1,CONPTR,FILE,PRV,STFROM
S SFILE=$$GET1^DIQ(536.4,CSLQD_,,.09)
S MYFDA=$NA(^TMP(CSLFDA,$J))
K @MYFDA ;delete anything there already
S BASE=$G(@CSLROOT@(HEADER,BASE_IEN))
Q:+BASE'0  ;error
S BIENS=BASE_,
S FILE=$$QFILE^CSLQY9(CSLQD)
;In a continuation message, we may not want to start counting
;from zero
S STFROM=0
S PRV=$$PREV^CSLQY8(CSLQD,BASE)
D:+PRV0
.S STFROM=$$GET1^DIQ(FILE,PRV_,,50)
;Iterate over records
S I=
F  S I=$O(@CSLROOT@(DATA,I)) Q:I=  D
.S LAST=I ;last seq no seen
.S MYIENS=+_I_,_BIENS
.;Get sequence number
.S CNT=+$G(@CSLROOT@(HEADER,INDEX))
.S @MYFDA@(SFILE,MYIENS,.01)=STFROM+I ; .01 is seq no
.;S @MYFDA@(SFILE,MYIENS,.01)=CNT
.;Now, iterate over ROOT nodes
.S J=
.F  S J=$O(@CSLROOT@(DATA,I,ROOT,VAL,J)) Q:J=  D
..S VAL=$G(@CSLROOT@(DATA,I,ROOT,VAL,J))
.. I $F(VAL,^) S V=VAL,VAL= D
...  *
... F II=1:1:$L(V,^) I $P(V,^,II)'= S
VAL=VAL_$P(V,^,II)_  
..S @MYFDA@(SFILE,MYIENS,J)=VAL
;Start over, and iterate through CHILD nodes
S I=
F  S I=$O(@CSLROOT@(DATA,I)) Q:I=  D
.D:$D(@CSLROOT@(DATA,I,CHILD))
..S J=
..F  S J=$O(@CSLROOT@(DATA,I,CHILD,J)) Q:J=  D
...S RSFILE=$G(@CSLROOT@(DATA,I,CHILD,J,HEADER,FILE))
...S MYIENS1=+_((LAST*I)+J)_,_+_I_,_BIENS
...S K=
...F  S K=$O(@CSLROOT@(DATA,I,CHILD,J,VAL,K)) Q:K=  D
S FLD1=$G(@CSLROOT@(DATA,I,CHILD,J,XREF,K))
S VAL1=$G(@CSLROOT@(DATA,I,CHILD,J,VAL,K))
S @MYFDA@(RSFILE,MYIENS1,FLD1)=VAL1
...D:$L($G(@MYFDA@(RSFILE,MYIENS1,.01)))'0
K @MYFDA@(RSFILE,MYIENS1) ;no .01 field!
S @MYFDA@(FILE,BIENS,50)=$G(@CSLROOT@(COUNT))+$G(STFROM)
;Finally, is there a continuation pointer?
D:$D(@CSLROOT@(CONTINUATION))
.S CONPTR=$G(@CSLROOT@(CONTINUATION))
.S @MYFDA@(FILE,BIENS,200)=CONPTR
;return name of FDA array
Q MYFDA

--- Kevin Toppenberg [EMAIL PROTECTED] wrote:

 Greg,
 
 I'm not sure you would be able to make sense of just a
 snipet of the code.
 
 Let me reformat the FDA below.  The way I was showing
 it below is supposed to be an ASCII representation of
 a data tree.
 
 FDA(200,?+1,,.01)= DOE,JOHN
 FDA(200,?+1,,1)= JD
 FDA(200,?+1,,7)= NO
 FDA(200,?+1,,7.2)= YES
 FDA(200,?+1,,11.2)= TODAY
 FDA(200,?+1,,20)= UCI
 FDA(200,?+1,,29)= FAMILY PRACTICE
 FDA(200.02,?+1,,.01)= TMGDivison
 
 Again, I'm pretty sure that last line is wrong.
 
 Thanks
 Kevin
 
 --- Greg Kreis [EMAIL PROTECTED] wrote:
 
  I am not sure I can make out what your FDA array is
  looking like.  Can 
  you show the setup and call?
  
  Kevin Toppenberg wrote:
  
  Hey all.  I am having trouble setting up FDA
  properly.
  
  Here is the data I want to put into the database:
  
   FDA(*)
   }200= ''
   | }?+1,= ''
   | | }.01= DOE,KOHN
   | | }1= JD
   | | }7= NO
   | | }7.2= YES
   | | }11.2= TODAY
   | | }20= UCI
   | | }29= FAMILY PRACTICE
   }200.02= ''
   | }?+1,= ''
   | | }.01= TMGDivison
  
  The problem is that I think I am doing the subfile
  wrong.  File 200.02 is really field#16.  So I need
  to
  tell it to put the data into subfile 200.02 INSIDE
  the
  record for the data above.
  
  I have read the FDA documentation several times,
  and
  it always makes my head hurt.  I'm sure its easy
  once
  one gets the hang of it.  At the WorldVistA
  conference, Rick told me he had designed this
  interface and that he was sorry. LOL.
  
  My brain is tired.  Can someone just tell me the
  correct format?
  
  Also, this FDA is to be used with UPDATE^DIE.
  When I try the above FDA, I get this error message:
  
  +===+
  | ! ERROR . . .   |..
  +---+ :
  | Fileman says 'A multi-valued field| :
  | cannot be processed by this utility.  | :
  +===+ :
:
  
  I don't know if this is related to the issue I am
  describing above.  What is Fileman telling me?
  
  Thanks
  Kevin
  
  
  
 
  __ 
  Do you Yahoo!? 
  Meet the all-new My Yahoo! - Try it today! 
  http://my.yahoo.com 
   
  
  
  
 
 ---
  SF email is sponsored by - The IT Product Guide
  Read honest  candid reviews on hundreds of IT
  Products from real users.
  Discover which products truly live up to the 

Re: [Hardhats-members] Trouble setting up FDA

2004-11-24 Thread Greg Woodhouse
You're probably right. This is just something I've neve tried to do, so
I was uncertain as to whether it would work, particularly (as I
explained previously) because there seemed to be an ambiguity in how it
could be interpreted. I'll have to go back to the documentation and
take a closer look.

--- Kevin Toppenberg [EMAIL PROTECTED] wrote:
 
 Regarding the ?+1 symbol and having multiple
 searches, in my line below:
   FDA(200.02,?+2,?+1,.01)= TMGDivison
 It looks like there are two searches in this line. 
 But doesn't the ? symbol mean search only the FIRST
 time it is used?  After that it becomes a placeholder
 for the already-looked-up record.  So in this case,
 the ?+1 had been used before to find the record, so
 the only search is the ?+2 symbol.  This is quite
 confusing to me.  I think I would have set this
 interface up differently...
 


=
A practical man is a man who practices the errors of his forefathers. 
--Benjamin Disraeli

Greg Woodhouse 
[EMAIL PROTECTED] 
[EMAIL PROTECTED] 





---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
Hardhats-members mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hardhats-members


Re: [Hardhats-members] Trouble setting up FDA

2004-11-24 Thread Kevin Toppenberg
Greg,

I really appreciate the help you have given me here. I think I have figure it out now So don't feel you need to do any research. After all, it's Thanskgiving Eve!

Happy TurkeyDay!

KevinGreg Woodhouse [EMAIL PROTECTED] wrote:
You're probably right. This is just something I've neve tried to do, soI was uncertain as to whether it would work, particularly (as Iexplained previously) because there seemed to be an ambiguity in how itcould be interpreted. I'll have to go back to the documentation andtake a closer look.--- Kevin Toppenberg <[EMAIL PROTECTED]>wrote:  Regarding the "?+1" symbol and having multiple searches, in my line below: FDA(200.02,"?+2,?+1",.01)= TMGDivison It looks like there are two searches in this line.  But doesn't the "?" symbol mean search only the FIRST time it is used? After that it becomes a placeholder for the already-looked-up record. So in this case, the ?+1 had been used before to find the record, so the only search is the ?+2 symbol. This is quite confusing to me. I
 think I would have set this interface up differently... =A practical man is a man who practices the errors of his forefathers. --Benjamin DisraeliGreg Woodhouse [EMAIL PROTECTED] [EMAIL PROTECTED] ---SF email is sponsored by - The IT Product GuideRead honest  candid reviews on hundreds of IT Products from real users.Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/___Hardhats-members mailing list[EMAIL PROTECTED]https://lists.sourceforge.net/lists/listinfo/hardhats-members
		Do you Yahoo!? 
The all-new My Yahoo! – What will yours do?

Re: [Hardhats-members] Trouble setting up FDA

2004-11-23 Thread Greg Kreis
I am not sure I can make out what your FDA array is looking like.  Can 
you show the setup and call?

Kevin Toppenberg wrote:
Hey all.  I am having trouble setting up FDA properly.
Here is the data I want to put into the database:
FDA(*)
}200= ''
| }?+1,= ''
| | }.01= DOE,KOHN
| | }1= JD
| | }7= NO
| | }7.2= YES
| | }11.2= TODAY
| | }20= UCI
| | }29= FAMILY PRACTICE
}200.02= ''
| }?+1,= ''
| | }.01= TMGDivison
The problem is that I think I am doing the subfile
wrong.  File 200.02 is really field#16.  So I need to
tell it to put the data into subfile 200.02 INSIDE the
record for the data above.
I have read the FDA documentation several times, and
it always makes my head hurt.  I'm sure its easy once
one gets the hang of it.  At the WorldVistA
conference, Rick told me he had designed this
interface and that he was sorry. LOL.
My brain is tired.  Can someone just tell me the
correct format?
Also, this FDA is to be used with UPDATE^DIE.
When I try the above FDA, I get this error message:
+===+
| ! ERROR . . .   |..
+---+ :
| Fileman says 'A multi-valued field| :
| cannot be processed by this utility.  | :
+===+ :
 :
I don't know if this is related to the issue I am
describing above.  What is Fileman telling me?
Thanks
Kevin

		
__ 
Do you Yahoo!? 
Meet the all-new My Yahoo! - Try it today! 
http://my.yahoo.com 


---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
Hardhats-members mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hardhats-members

 


---
SF email is sponsored by - The IT Product Guide
Read honest  candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
___
Hardhats-members mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/hardhats-members


Re: [Hardhats-members] Trouble setting up FDA

2004-11-23 Thread Greg Woodhouse
Okay, I'll take a closer look at this tomorrow. But one possible
solution is to make a call to FIND^DIC first, then build an FDA array
that uses either +1 or the actual IEN at the top level.

Are you actually using XML, or were you just using it here to clarify
your intent? I ask because a teccchnique I've found useful is to use
the MXML parser that comes with VistA to build a DOM object and then
traverse it to build an FDA array.

--- Kevin Toppenberg [EMAIL PROTECTED] wrote:

 George,
 
 My intent is to allow a user's script to look
 something like this:
 
   Record id=GenericUser File=NEW PERSON
   Field id=NAMEDOE,JOHN/Field
   Field id=INITIALJD/Field
   Field id=DIVISION|.01TMGDIVISION/Field
   Field id=DIVISION|DEFAULTYES/Field
   Field id=UCIUCI/Field
   Field id=DISUSERNO/Field
   Field id=SERVICE/SECTIONFAMILY PRACTICE/Field  
 
   /Record
 
 The default is that the .01 field is used for
 searching for old records.  (If the user wants to use
 more fields for locating an existing record, then a
 'MatchThis' flag is available for any other field.)
 
 Once the record is located, then all the data should
 be put into it.
 
 Regarding subfields, the same search and upload logic
 should be used, i.e. search for existing and use if
 found, otherwise add new record.
 
 So 4a vs. 4b, ... I'm not sure.  I think what I am
 describing above is closer to 4a.
 
 I appreciate your help!
 
 Thanks
 Kevin
 
 
 --- Greg Woodhouse [EMAIL PROTECTED] wrote:
 
  I don't think you want a question mark at the second
  level. 
  
  Is your intended logic
  
  1) Search for entries matching a given value
  2) If you find a match, use that record
  3) Otherwise, create a new one
  4a) Then, add subentries if no EXISTING subentries
  match in records
  that already exist 
  
  or
  
  4b) Then, add the subrecord to new records you
  create (but leave old
  ones alone)
  
  My assumption was that you intended 4b. If you
  intend 4a, I think you
  may actually need two calls.
  
  --- Kevin Toppenberg [EMAIL PROTECTED] wrote:
  
   Greg,
   
   Thanks for your feedback.  It is hard for me to
  follow
   the code below, especially since I don't know the
   format of your inputs.
   
   So should I format FDA like this?
   
   FDA(200,?+1,,.01)= DOE,JOHN
   FDA(200,?+1,,1)= JD
   FDA(200,?+1,,7)= NO
   FDA(200,?+1,,7.2)= YES
   FDA(200,?+1,,11.2)= TODAY
   FDA(200,?+1,,20)= UCI
   FDA(200,?+1,,29)= FAMILY PRACTICE
   FDA(200.02,?+2,?+1,.01)= TMGDivison
   
   And are there multiple ways that this could be
  stated?
I.e. subfile 200.02 is really field 16.  And to
  file
   into a field, usually one uses:
   FDA(FILENUMBER,IENS,FIELD)=VALUE
   
   Thanks
   Kevin
   
   --- Greg Woodhouse [EMAIL PROTECTED] wrote:
   
I guess that one code snippet is pretty cryptic.
Here's my whole
function BLDFDA. This is a step in copying the
(parsed) contents of an
HL7 message to Fileman.


BLDFDA(CSLQD,CSLROOT)   ;
N
   
  
 
 MYFDA,I,II,J,K,BASE,MYIENS,FLD,IENS,BIENS,VAL,SFILE,CNT
N
   
  LAST,RSFILE,MYIENS1,FLD1,VAL1,CONPTR,FILE,PRV,STFROM
S SFILE=$$GET1^DIQ(536.4,CSLQD_,,.09)
S MYFDA=$NA(^TMP(CSLFDA,$J))
K @MYFDA ;delete anything there already
S
  BASE=$G(@CSLROOT@(HEADER,BASE_IEN))
Q:+BASE'0  ;error
S BIENS=BASE_,
S FILE=$$QFILE^CSLQY9(CSLQD)
;In a continuation message, we may not
  want
to start counting
;from zero
S STFROM=0
S PRV=$$PREV^CSLQY8(CSLQD,BASE)
D:+PRV0
.S STFROM=$$GET1^DIQ(FILE,PRV_,,50)
;Iterate over records
S I=
F  S I=$O(@CSLROOT@(DATA,I)) Q:I=  D
.S LAST=I ;last seq no seen
.S MYIENS=+_I_,_BIENS
.;Get sequence number
.S CNT=+$G(@CSLROOT@(HEADER,INDEX))
.S @MYFDA@(SFILE,MYIENS,.01)=STFROM+I ;
  .01
is seq no
.;S @MYFDA@(SFILE,MYIENS,.01)=CNT
.;Now, iterate over ROOT nodes
.S J=
.F  S
J=$O(@CSLROOT@(DATA,I,ROOT,VAL,J)) Q:J= 
  D
..S
VAL=$G(@CSLROOT@(DATA,I,ROOT,VAL,J))
.. I $F(VAL,^) S V=VAL,VAL= D
...  *
... F II=1:1:$L(V,^) I
  $P(V,^,II)'= S
VAL=VAL_$P(V,^,II)_  
..S @MYFDA@(SFILE,MYIENS,J)=VAL
;Start over, and iterate through CHILD
nodes
S I=
F  S I=$O(@CSLROOT@(DATA,I)) Q:I=  D
.D:$D(@CSLROOT@(DATA,I,CHILD))
..S J=
..F  S
  J=$O(@CSLROOT@(DATA,I,CHILD,J))
Q:J=  D
...S
   
  
 
 RSFILE=$G(@CSLROOT@(DATA,I,CHILD,J,HEADER,FILE))
...S
MYIENS1=+_((LAST*I)+J)_,_+_I_,_BIENS
...S K=
...F  S
K=$O(@CSLROOT@(DATA,I,CHILD,J,VAL,K))
  Q:K= 
D
S
FLD1=$G(@CSLROOT@(DATA,I,CHILD,J,XREF,K))