Options

XMLport Import Text Element not clearing itself - still filled on next loop

bennybbennyb Member Posts: 4
Hello I got a problem while importing an xml file. Somehow I can't find anyone having the same problem on google ._.

So my structure is following

MLIST
- M
- DATA1
- DATA2

I do processing in the M - Import::OnAfterAssignVariable()
Now let's assume DATA1 is always filled and DATA2 like every third loop only. So it's filled in M1 and M4, but empty in M2 and M3.
My problem now is, that DATA2 gets a value in M1 and now has the same value in M2 and M3.
How can I prevent that without making a CLEAR for every variable that could be empty?
The element doesn't come in M2 and M3 - so it doesn't clear itself I think?

Like
M1
DATA1 (fills with 1)
DATA2 (fills with XYZ)
M2
DATA 1 (fills with 2)
DATA 2 is not provided, so it keeps the value of M1 DATA2 (XYZ)
M3
DATA 1 (fills with 3)
DATA 2 (fills with ASD)

Is there any workaround?

Answers

  • Options
    lubostlubost Member Posts: 618
    If Data2 is globally defined variable, never clears itself.
  • Options
    bennybbennyb Member Posts: 4
    lubost wrote: »
    If Data2 is globally defined variable, never clears itself.

    It is an element in the XMLport structure, not a global defined by myself. It fills itself by importing the xml file.
  • Options
    rxqrxqrxq_zydrxqrxqrxq_zyd Member Posts: 19
    you can reset all field (DATA2.INIT) with INIT before import any fields VALUE
  • Options
    JohnnyGJohnnyG Member Posts: 1
    I'm seeing the same issue in BC v14 on prem. If the prior data element had a value, but the current data element doesn't, the old data is kept in memory. I expect it to clear after each iteration of the record. Are we supposed to clear the data elements after we insert into the record?
  • Options
    bennybbennyb Member Posts: 4
    JohnnyG wrote: »
    I'm seeing the same issue in BC v14 on prem. If the prior data element had a value, but the current data element doesn't, the old data is kept in memory. I expect it to clear after each iteration of the record. Are we supposed to clear the data elements after we insert into the record?

    Yes, it seems there is no other way than doing a CLEAR yourself when you have no possibility to change the receiving xml. The best solution would be to receive all fields even when they're empty - as then it would be cleared by the empty value.
Sign In or Register to comment.