Dataports. 1field to many.

Hello having a bit of a problem with my first data port. I am importing into the Article table via text file. Fileformat=variable Fieldseparator=<;> Using the same field from my text file, I need to update more then one field in my Article table. Is there away to program this using a data port? I know I could duplicate the same coloume in the text file. But that’s no fun! Regards. Graham Spencer +46 8 764 74 25

Graham: That`s not such a complicated task: Assumed, there are three values in your ACSII-data you declare the following variables: intVar1 Integer txtVar2 Text decVar3 Decimal Then choose View/Dataport Fields in the main menue und declare these variables for import: Enabled SourceExpr StartPos Width yes intVar1 yes txtVar2 yes decVar3 You can leave StartPos and With blank when your source data is separated by , ; @ or whatever you want. OnBeforeImportRecord() CLEAR(intVar1); CLEAR(txtVar2); CLEAR(decVar3); OnAfterImportRecord() DestTable.intVar1 := intVar1; DestTable.txtVar2 := txtVar2; DestTable.decVar3 := decVar3; // If there is a 4th tablevariable you want to fill with // the value of one of the read values you can do so: DestTable.intVar4 := intVar1; // then store it DestTable.INSERT; That´s it. Have fun! Regards Uwe

Hello Uwe Thanks you for taking the time to help me out. I have been working on this problem on and off now for a few days. After your help I now have a Dataport working its great… ( AND SO EASY) After getting the massage Article already exists I removed the line: - DestTable.INSERT. Regards Graham. P.S If you are ever in Sweden give us a call I’ll buy you lunch. P.P.S Am starting to like this Navision.

Hi Graham, Your last post worried me a bit. What if your textfile contains new records that need to be imported ? Then you definitly need your “DestTable.INSERT”. Maybe you should consider using the properties “AutoSave”, “AutoUpdate” and “AutoReplace” on your dataitem. In the helpfile you’ll find some explanation of these properties. Otherwise you can always contact me for further information. PS : I’ll be satisfied with you buying me a beer whenever I’ll be in Sweden ! :wink: May the source be with you

Try this one out… example of customer dataport (source table is Customer. have a global called cust, record of type Customer. dataport fields are No.,Name,Phone No. for example turn off autosave and autoupdate. in OnAfterImportRecord have this if not cust.get(“no.”) then begin cust.init cust.“no.”:=“no.”; cust.validate(name,name); cust.“phone no.”:=“phone no.” cust.insert; cust.modify; end else begin cust.validate(name,“name”); cust.“phone no.”:=“phone no.” cust.modify; end; Craig Bradney Project Manager - Technical Navision Solutions & Services Deloitte Growth Solutions Deloitte Touche Tohmatsu P:+61-2-9322-7796 F:+61-2-9322-7502

Hi Fozie & Cbradney I have been over whelmed with the help that that I have received with my question about data ports, And as for you being worried Fozzie I’ll buy you 2 beers. I was so happy that I got data into my Navision Table that I was not thinking about re-usability. (Sham on me). I have also found that I am unable too update records in my table. But Cbradney can up with a high tec way of solving this, 2 Beers to Cbradney as well. Regards Graham. Why use Visual Basic when you have data ports.

Hi Graham, >>2 Beers to Cbradney as well.<< If you have a 3-beer-question, I’m going to answer it :-))) Marcus Marcus Fabian phone: +41 79 4397872

Hi Marcus, with 67 postings in Hmmmmmm a 3-beer question Marcus… Do you know how big and strong the Swedish beers are? Not that I’m knocking these little beers you serve in Switzerland. All said and done and after a lot of drinking I mean thinking I came up with a not a 3 beer but 4 beer question. Are you ready? How can I fire events/triggers inside C/SIDE from my Visual Basic code via com of course. Ouch that was a below the belt question. Regards Graham. Why use C/shells when you have beer tokens.

Why use C/shells when you have beer tokens. << 'cos some of us doesn’t really like beer… :wink: About how firing event triggers inside C/Side from your visual Basic code via com it’s easy… send the suggestion to Navision at Denmark… wait at least three new Navision versions… send the suggestion again… waith another three Navision versions… send it again, then read the posts at the forum and probably someone would have solved it before Denmark adds it to Navision (then just will took three more Navision versions to try to include it on Navision standard… ) :wink: Alfonso Pertierra Spain

Right, Alfonso, that’s one of the three things which don’t work in Navision (concerning OCX) 1) You cannot fire a trigger within navision 2) There is no exception handling in Navision 3) VarChar is limited to 250 bytes Damn, I guess I have to stick with swiss beer until Graham comes up with a question I’m able to answer :slight_smile: Marcus Fabian phone: +41 79 4397872