Hi all, [?] **** i need to develop a single dataport for importing from many files(100’s of Excel files Having similar DAta) at a time. data is coming from many places. **** i think we can prepare a report. so that we can run dataport in OnAftergetrecord(). i have a table with ‘filenames’ as a field. the file names are available in this Table. here i need to run a dataport which is used to import the data which are located in different excel files. so that we have to run the dataport, that to number of record times. but we need to provide the file names dynamically by reading through Table. and pass it to Dataport. will u plz suggest a solution for me. how can i provide the file name to the dataport? Thanks in Advance.
Define a function in your Dataport SetFileName(NewFileName : Text) FileName := NewFileName; and set the given filename on startup OnPreDataport(); CurrDataport.Filename := Filename; Now you can run your dataport with MyDataport.SetFileName(Rec.Filename); MyDataport.RUN;
There’s no need for a function like that. The filename property seems to be accessible when you declare a dataport type variable. Syntax: [CurrFileName] := FILENAME([NewFileName])
If you want to start the dataport several times for a specific file, you need this function for to tell the dataport which file it should import. Within the dataport you didn’t need the function, there you can set the values directly but ramesh must start this dataport several times for several files (e. g. out of a report, form, …).
So then do this in OnAfterGetRecord of the MyRec dataItem: CLEAR(MyDataport); MyDataport.FILENAME(MyRec.Filename); MyDataport.RUN; You don’t need to add the custom function, because the dataport object has this functionality built in.
Upps, I’m sorry. You are right, it is possible to access the Filename from another objekt, so it is not neccessary to create such a function. I haven’t seen the properties.
As well as the above soultion, you may also look to doing it directly in code. When you have so much data to handle, it can get complex handling and maintaining dataports, where as pure code can make it a lot clearer and much easier to debug.
Oh and btw you are also going to have to address the issue of converting the xls to a csv. Keeping that in mind, if you do this in code, then create an Excel object as an automation, and pull the data that way. You will have to offset the slownest of the automation, compared to the manual steps required for other solutions. The Excel automation is very easy code wise.