we have a code unit for importing text files to create sales orders.
for a short term measure, when we import, we need to use one of the data fields to trigger an option field..
the option field defaults to "No", and during the import the following is needed :
if data[x] = ABC then
option field := yes
however, this leads, understandbly to the can not convert from text to option..
from reading about this, i "guess" that i need to use optionfield::yes , but im not sure of how to go about this! (and i thought this would be an easy one!!)
0
Comments
OptionField := OtionField::yes ;
Please not that if your option is simply Yes/No, it is more easy to use a boolean field. In this case, you can write :
BooleanField := (data[x] = ABC);
or :
if data[x] = ABC then BooleanField := TRUE;
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
I have tried the suggestion (in the create header of the c.u)
as follows :
IF Data[20] = ABC THEN
SalesHdr."Field X" := SalesHdr."Field X"::Yes;
Although i dont get a compling error, when importing the text file Field X doesnt get populated with Yes
-Are you sure "SalesHdr" is the record you are saving
-Are you sure you put the code in the "OnAfterImportRecord"-trigger?
-extra : don't forget to do a clear of all variables in the fieldlist in the "OnBeforeImportRecord". If in a record a value is blank, it takes the previous value.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
The import is done via a code unit previously written by a NSC. It does not contain the onAfterImportRecord sections.. Instead amongst others it contains a create header section : relating to the sales order header.
i have put the code in this create header section (which is where i can see other fields being populated), and within the section there is a clear saleshdr.
one further point which may help, is that data20 is actually being copied from data6, as this data6 may be set to blank depending on another circumstance. therefore data 20 always contains the original data.
however, the field populated by data20 shows the correct ABC etc, so this indicates that this process is working..
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!