You are viewing this site as a guest. You can still ask questions and help others! Join our Dev2Dev IT Community to receive your own blog, share your knowledge, and much more.

Inbound in Application Engine

4 replies [Last post]
csnrkrishna's picture
User offline. Last seen 7 years 17 weeks ago. Offline
Joined: 10/29/2010
Posts: 7

I have data in my Excel sheet (sheet1, sheet2, sheet3 )and i want to upload the data into the data base using Application Engine.

Could you tell me any one how to do that for multiple sheets in a single excel file.

Lepa's picture
User offline. Last seen 2 years 5 weeks ago. Offline
Joined: 06/23/2008
Posts: 591
Re: Inbound in Application Engine

never had to do read from an excel sheet. It is ALOT easier to read from a CSV file. I know for a fact that you need a windows server with excel installed on it to be able to read and write excel sheets from an Application Engine. If you are on a Unix box, you need to deal with CSV files and file layouts and not excel.

Give back to the community and help it grow!
* Help with unanswered forum questions and issues
* Register or login to share your knowledge at your own blog

mahendra's picture
User offline. Last seen 9 years 9 weeks ago. Offline
Joined: 08/17/2011
Posts: 8
Re: Inbound in Application Engine

Hi Krishna,

Here iam giving one example for your scenario/Question.

Example: I want to upload the data into record(Database) by using files,that means am having data from multiple files(.CSV/XLS).
We need to create a Filelayout based on your columns and drag and drop the filelayout into AE Peoplecode action and you need to customised that code.The below iam giving sample code for multiple excel files data upload to database.

Local array of string &FNAMES;
Local File &FILE1;
&FNAMES = FindFiles("C:\temp\*.csv", %FilePath_Absolute); /* Here * indicates fetching the multiple Excel files in that temp folder */
While &FNAMES.Len > 0 /* Here Len>0 indicates length >0 all files are fetching and upload the data into database */
&FILE1 = GetFile(&FNAMES.Shift(), "r", "a", %FilePath_Absolute);
&LOGFILE = GetFile("D:\temp\ErrorLog.err", "W", %FilePath_Absolute);
&FILE1.SetFileLayout(FileLayout.MA_TEST_FL);
&LOGFILE.SetFileLayout(FileLayout.MA_TEST_FL);
&RS1 = &FILE1.CreateRowset();
&RS = CreateRowset(Record.MA_TEST_STG);
&SQL1 = CreateSQL("%Insert(:1)");
&RS1 = &FILE1.ReadRowset();
While &RS1 <> Null;
ImportSegment(&RS1, &RS);
&RS1 = &FILE1.ReadRowset();
End-While;
&FILE1.Close();
&LOGFILE.Close();
End-While;

Regards,
Mahendra
Note: If am wrong please correct me.

Regards,
Mahendra
Peoplesoft-Analyst Programmer

Guest's picture
Guest (not verified)
Re: Inbound in Application Engine

Shift() ... What it will do ?

Guest's picture
Guest (not verified)
Re: Inbound in Application Engine

Hi ,

Shift() will get the files in that particular path based on number of files like one by one means shift wise.

Regards,
Mahendra