Conversion failed when importing enum value

Hi All,
I have one issue in DIXF 2012 r3.i have to import and export B/W two legal entity’s. we are using CSV as a source data format
I have a table with Enum filed TransType with almost 100 element.
for example element Zero has element Zero has : SalesOrder, Invoice
and elememnt 1 has lablel : purchaseorder, posting
elmemt 3 label is : returnorder, canceled
like this I have enum values.

after creating processing group, while importing data in to staging is working with out errors
but while copying data in to target its showing some SQL Error.
its taking only one comma value in the Enum element label.

error is ::
Results. Record (’’) . Cannot select a record in a table Account type: Product receipt.
SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server]Conversion failed when converting the nvarchar value " invoice " to data type int.

any one help here plz

Hello it is because of enum value, you are passing it as string and it is considering as enum int value. try to pass integer number of enum instead of text

DMF/DIXF has an internal conversion mechanism to tackle strings that represent enums. It converts the strings automatically into enums. However, there are some pitfalls to avoid, make sure that you have set up correctly, that is, that the value is not pushed directly into the enum but mapped so that the core mechanism can handle it. Also, since the mechanism converts string to enum automatically, it uses the label as a guide. If the userid reponsible for processing has another language set up, the labels may differ. For example if the CSV has a string representing the enum “Inventory”, then you will get the error if it is run in another language which uses the label “Stock” instead. Best way to make sure the mapping is done correctly is to compare with an un-altered DMF entity from MS that has a string to enum field, such as DMFLedgerJournalEntity, where for instance “AccountType” is mapped directly.

Hi Kunal,

Thanks for yours time.
I already converted enum to string using below logic in entity class addStagingLink()
qbd.addRange(fieldNum(Tablename, Enum)).value(queryValue(Enum2str(enumNum(Enum))));

but its not solve my issue .

because my enum has labels like salesorder, invoice
second element label : salesorder, conformed , invoice
and third element label : salesorder, conformed , posted, invoiced like this
means labels have multiple values separated by columns
in source to staging working correctly , but staging to target : after comma value jumping in to next column in target table

You can’t map multiple value to a single enum field. You’ll have to implement some logic to do something with them.
For example, each value in your list of enums may be used to create a new record in a related table.
AX can’t know what you intend to do with those values; it’s up to you.

can you check in staging how data is coming,
i think you are using comma separator and because of that your value is going in next column,
try to use the different separator…/microsoft-dynamics-ax-2012-import.html