Hello together,
I'm facing a problem with assigning values to a field in a struct.
I have this code (sStruktur is a struct datatype)
 sStruktur->rechnung->"%%LP_GetMapping4Field(sTable, 
'RE_RECHNG_DAT')%%%" = LP_FormatValue("RE_RECHNG_DAT.%%sTable%%%", 
$item("RE_RECHNG_DAT", sRecord_SLDA_RECHNUNG))
In my programm I would expect as value in my struct:

But what happens?

In debugger I can see, that after "LP_FormatValue the function LP_GetMapping4Field is called once again and the return of this function is assigned to.
What's going on there? In my eyes this is not correct behaviour.
If I use this code
    sTemp = LP_FormatValue("RE_RECHNG_DAT.%%sTable%%%", $item("RE_RECHNG_DAT", sRecord_SLDA_RECHNUNG))
    sStruktur->rechnung->"%%LP_GetMapping4Field(sTable, 'RE_RECHNG_DAT')%%%" = sTemp
it works as expected.
Cheers,
Michael.
Hello Michael,
I can see the problem here as well. I'm not sure, why LP_GetMapping4Field is called twice. Need to check.
And I also saw that the correct value is assigned when LP_FormatValue is embedded in a string-substitution. E.g.
sStruktur->rechnung->"%%LP_GetMapping4Field(sTable, 'RE_RECHNG_DAT')%%%" = "%%LP_FormatValue("RE_RECHNG_DAT.%%sTable%%%", $item("RE_RECHNG_DAT", sRecord_SLDA_RECHNUNG))%%%"Although, the Proc Module LP_GetMapping4Field is still called twice.
You also could encapsulate the code for creating a new Struct node in another Proc Module. Something like:
; **********
call LP_CreateNode(sStruktur->rechnung, LP_GetMapping4Field(sTable, 'RE_RECHNG_DAT'), LP_FormatValue("RE_RECHNG_DAT.%%sTable%%%", $item("RE_RECHNG_DAT", sRecord_SLDA_RECHNUNG)))
; ...
entry LP_CreateNode
 params
  struct pStruct : IN
  string pNodeName : IN
  any pNodeValue : IN
 endparams
 pStruct->"%%pNodeName" = pNodeValue
end;- LP_CreateNode
; **********
Hope this helps.
Cheers,
Daniel
                
     
                                    
            Hello together,
I'm facing a problem with assigning values to a field in a struct.
I have this code (sStruktur is a struct datatype)
 sStruktur->rechnung->"%%LP_GetMapping4Field(sTable, 
'RE_RECHNG_DAT')%%%" = LP_FormatValue("RE_RECHNG_DAT.%%sTable%%%", 
$item("RE_RECHNG_DAT", sRecord_SLDA_RECHNUNG))
In my programm I would expect as value in my struct:

But what happens?

In debugger I can see, that after "LP_FormatValue the function LP_GetMapping4Field is called once again and the return of this function is assigned to.
What's going on there? In my eyes this is not correct behaviour.
If I use this code
    sTemp = LP_FormatValue("RE_RECHNG_DAT.%%sTable%%%", $item("RE_RECHNG_DAT", sRecord_SLDA_RECHNUNG))
    sStruktur->rechnung->"%%LP_GetMapping4Field(sTable, 'RE_RECHNG_DAT')%%%" = sTemp
it works as expected.
Cheers,
Michael.
Hello Daniel,
thank you very much for your quick response. It's good to see, that you can reproduce this issue.
For me it look like a bug, which should be fixed. So, I'm waiting for the results of your further investigations.
Cheers,
Michael