IF Action and XML

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf IF Action and XML

  • Creator
    Topic
  • #51504
    Bill May
    Participant

      Dear Clovertechers,

      I’m having some difficulty with an IF statement in an xlt that uses xml for both input and output record format

      The IF statement looks like

      nm1:OMG_O19.nm1:OMG_O19~ORDER(%g1).nm1:ORC.nm1:ORC~25.nm1:CWE~1.#text  eq =C01

      Yes I know the source field name is LONG

      When I try to test the xlt I get

      [0:TEST] IF expression parse failed: Expected a relational operator

      Error occurred at: ‘C~25.nm1:CWE~1.#text  eq =C01’

      [0:TEST] Unable to compile XLT ‘omg_o19_gcrs_pbrc.xlt’.

      Its almost as if the soure field name gets truncated

      So I tried copying the source field to @orc25 (a temporary variable) then modify my If statement to look like

      @orc25 eq =C01

      This does not give an error but for some reason the IF statement always equates to false (even thought I know the value of @orc25 is C01)

      So I tried setting another temporary variable to C01  so my IF statement becomes

      @orc25 eq @test_value

      Same result IF stetment always false

      I have treid using == rather than eq – same result IF stement always false

      So in desperation I tried

      @orc25 eq @orc25 and IF statement was true

      Does anyone have any ideas on how I can test the value of a XML source field against a constant

      Cheers,

      Bill

    Viewing 0 reply threads
    • Author
      Replies
      • #70536
        Robert Kersemakers
        Participant

          Hi Bill,

          Although not ‘fluent’ in XML, we have a few XML translations and comparing a field against a constant works in the normal way:

          Code:

          ZORDERS05_RDC.IDOC(%g1).E1EDP01(%g2).E1EDP05(%g3).KSCHL.#text eq =RA01

          Looking at your code, I am not sure what the ‘nm1:’ means, nor the ‘~’ inside your XML field address. Is that a correct address? Can you echo the contents of this address to see what it contains?

          You didn’t by chance copy another IF-statement in your translation and then worked with this new IF-statement? Could be you are having problems because of this known bug.

          Zuyderland Medisch Centrum; Heerlen/Sittard; The Netherlands

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