Testing a field for NULL or BLANK in Xlate

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Testing a field for NULL or BLANK in Xlate

  • Creator
    Topic
  • #48972
    Manny Zachodin
    Participant

    I am trying to use IF/ELSE in xlate based on a filed that is equal to NULL or BLANK, and getting an error

    “[0:TEST] Bad value ‘””‘

    [0:TEST] IF expression parse failed: Value references must yield exactly one datum

    Error occurred at: ‘”‘

    Tried If fieldname ne NULL, ‘ ‘, ” “…etc and always get the same error.

Viewing 7 reply threads
  • Author
    Replies
    • #60279
      Jim Kosloskey
      Participant

      Manny,

      Have you tried @null?

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #60280
      Manny Zachodin
      Participant

      I tried @null ask per your advice and it worked. Do you know if @blank will work too? Thanks again for your advice.

    • #60281
      Jim Kosloskey
      Participant

      Manny,

      There is not an intrinsic temp variable that I am aware of that is known as @blank.

      Besides, if this is an HL/7 or X12 message, you should not see a field (or component or sub-component for that matter) with all spaces.

      If however, this is something other than a structured message (such as FRL or VRL) then you will need to use a Tcl proc to check to see if the field is all spaces or if it contains spaces in any dimension.

      Jim Kosloskey

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #60282
      Anonymous
      Participant

      Manny,

      What I’ve done in the past if a message comes in with a space in an HL7 field is to set a temp variable (in this case you could use @blank) to equal a space.  Then you can use that @blank in your IF statement.

      Hope this helps…

      Thomas G. Rioux

    • #60283
      Mary Bodoh-Stone
      Participant

      Hi,

      I need to check if a field is null or contains 2 blanks (purposely put there).  I assigned a temp variable @2blanks to =”  ” or  =  <— 2 spaces here.

      Then depending on if MyMod ne @2blanks ….do something  I get a tcl error no matter which way I try.

      MESSAGE 1

      [0:TEST] QDX_Tcl_SplitList({ ) failed: unmatched open brace in list

      Internal XPM Tcl error

      QDX_Tcl_SplitList failed:: unmatched open brace in list

      Suggestions?  Thanks.

      – Mary

    • #60284
      Levy Lazarre
      Participant

      Mary,

      I was curious about your error, so I tried the second assignment:

      Code:



      I assigned a temp variable @2blanks  =  <— 2 spaces here.

      I then tried an IF statement: IF Myfield ne @2blanks and it worked fine. There was no syntax error.

    • #60285
      Tom Rioux
      Participant

      Maybe the issue isn’t with your @2blanks variable but the “MyMod” that you are attempting to reference with your if.

    • #60286
      Chris Williams
      Participant

      The error being reported is with the argument you are passing to the proc  QDX_Tcl_SplitList. It would appear that it is a variable whose value resolves to “{“.

Viewing 7 reply threads
  • The forum ‘Cloverleaf’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,432
Topic Tags
286
Empty Topic Tags
10