NetTalk Central

Author Topic: Importing an excel file using FileUpload and oiExcel  (Read 2093 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Importing an excel file using FileUpload and oiExcel
« on: September 04, 2020, 09:09:27 AM »
Hi,
Im importing an excel file using FileUpload and then reading it using oiexcel.

1-How to keep the "Import data from excel" button disable till one excel file is uploaded?
Ive tried cheking loc:upload='' but it is called many times if the user clicks in the button.
Please see image.

2-To read the excel file to a queue Im using:
Quote
  MyExcel1.ProgressControl = loc:ProgressName
  MyExcel1.load(qExcelGenerico,p_web.gsv('loc:upload'))
Is this ok to use loc:ProgressName as a progresscontrol?
And how to check an inform a read error?

Thanks

-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Importing an excel file using FileUpload and oiExcel
« Reply #1 on: September 06, 2020, 04:03:51 AM »
>> then reading it using oiexcel.

you will need to be _very_ careful here;
a) Excel has to be installed on the server, int he same account as the WebServer / WebService.
b) you must make _sure_ that ONLY 1 file can be imported at a time - across all threads and all users.

>> 1-How to keep the "Import data from excel" button disable till one excel file is uploaded?

a) when the form is generated set a session value to false.
b) when an uploaded file arrives, set the session value to true, and refresh the button
c) set the button to be disabled (or invisible) if the session value is 0.

>> Is this ok to use loc:ProgressName as a progresscontrol?

I'm not sure your code makes sense here, since there is no Progress Control on a window to pass to MyExcel1.

cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1848
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Importing an excel file using FileUpload and oiExcel
« Reply #2 on: September 06, 2020, 04:13:18 AM »
b) when an uploaded file arrives...

How to know it?


b) you must make _sure_ that ONLY 1 file can be imported at a time - across all threads and all users.

Then, using .CSV instead would be a good idea?
« Last Edit: September 06, 2020, 04:17:38 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Importing an excel file using FileUpload and oiExcel
« Reply #3 on: September 06, 2020, 10:41:22 PM »
Hi Alberto,

>> b) when an uploaded file arrives...
>> How to know it?

Turn on the Debugview options for the form, so you can see the stages and events coming into the form.
The upload a file, and see what happens in the form.
Then follow the code...

cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11191
    • View Profile
Re: Importing an excel file using FileUpload and oiExcel
« Reply #4 on: September 06, 2020, 10:42:03 PM »
>> Then, using .CSV instead would be a good idea?

_anything_ other than XLS would be a good idea.
CSV, Json, xml, whatever...

cheers
Bruce