Hello,
I need to import some item data with a Dataport but my file only contains the item "Description". How can I get the "No." of the "Description" from Item table using a Dataport?
Please help! [-o<
The descriptions are unique but there will be possibility that they will not exactly match with the descriptions in our system. Some of our descriptions have comma (,) or dash (-) or letter "V" at end and they removed those in the file some times.
When the data might be an issue, I tend to import the data into a new table which I create.
Creating fields that match the data i'm importing. Also keeping in mind, matching the type and size that is used in the item table. Then once you have this info in a new table you can add another field called NO_LOOKUP or something which is a flowfield. With calc formula like:
Lookup(Item.No. WHERE (Description=FIELD(Impdescription)))
where ImpDescription (imported description) is the name of your field in your new table holding the data.
Now when you go look at the new table, if the descriptions match, the NO_LOOKUP should show a value. The one's that don't have a value you know you have a description mismatch. and you can focus fixing those descriptions.
Once you have every line showing a value you can do many things to transfer the data to update the item table. ei/process report.
Of you can even copy your whole table into excel and create a new file to be imported that now has an item no.
another way would be import your file data into variables in the dataport. Using FIND to get a match.
item.setrange(description, ImpDescription);
if item.find('=') then begin
map field
map field
end else begin
currdataport.skip;
end;
but since you don't know which ones will match or not I would use the 2nd table and lookup.
That way I can see what's correct and what's not and review all these items FIRST before I start making changes to my current data.
You have to decide what's best for you.
Is there any particular reason why you would prefer this to be done outside Navision? Except the fact that the Navision database would remain un-affected and clean. However, if it is a development database, how does that matter? Also, a lot of Navision developers feel comfortable in working with Navision objects, rather than working outside.
Just a curiosity, to know what is/are the main reason(s) you would recommend such an activity.
You have many more tools in Excel. Most importantly this is NOT A DEVELOPER project, developers should not be involved. This is a user project and users know Excel.
Comments
do the descriptions from your import file match exactly what you have in the system?
http://www.BiloBeauty.com
http://www.autismspeaks.org
Creating fields that match the data i'm importing. Also keeping in mind, matching the type and size that is used in the item table. Then once you have this info in a new table you can add another field called NO_LOOKUP or something which is a flowfield. With calc formula like:
Lookup(Item.No. WHERE (Description=FIELD(Impdescription)))
where ImpDescription (imported description) is the name of your field in your new table holding the data.
Now when you go look at the new table, if the descriptions match, the NO_LOOKUP should show a value. The one's that don't have a value you know you have a description mismatch. and you can focus fixing those descriptions.
Once you have every line showing a value you can do many things to transfer the data to update the item table. ei/process report.
Of you can even copy your whole table into excel and create a new file to be imported that now has an item no.
another way would be import your file data into variables in the dataport. Using FIND to get a match.
item.setrange(description, ImpDescription);
if item.find('=') then begin
map field
map field
end else begin
currdataport.skip;
end;
but since you don't know which ones will match or not I would use the 2nd table and lookup.
That way I can see what's correct and what's not and review all these items FIRST before I start making changes to my current data.
You have to decide what's best for you.
http://www.BiloBeauty.com
http://www.autismspeaks.org
Thanks Harry for your help. :thumbsup: :thumbsup: :thumbsup:
:thumbsup:
In cases like this I always recommend doing it out side of Navision. Put the data in Excel and do it there.
Is there any particular reason why you would prefer this to be done outside Navision? Except the fact that the Navision database would remain un-affected and clean. However, if it is a development database, how does that matter? Also, a lot of Navision developers feel comfortable in working with Navision objects, rather than working outside.
Just a curiosity, to know what is/are the main reason(s) you would recommend such an activity.
Kind regards,
Chn