1. John Vanleeuwe
  2. PowerBuilder
  3. Tuesday, 26 May 2020 03:58 AM UTC

Hi guys,

Using Appeon 2017 R3.

 

We are having an importstring fonctionality built in in our software. So our users can copy/paste records from an excel sheet into our software.

At the moment we are having 3 different uploads , where for every upload format the order of the fiels is different , or there are more fields for one upload interface compare to another.

Our users have to select which "upload format" they would like to use before the importstring function is called , this allows us to set the correct external datawindow.

Each customer can request their own upload format which will result after a while a dozen or so upload formats will be available.

 

I would like to be able to call the importstring function with a loop of datawindows.

If the returncode is -4 i know the upload/import didnt work.

In that case i can set the datawindow object again and try again...

 

This must work, i am convinced of this,  but the question is : how do i get rid off the error messages popping up if i try to put a string in a column that isnt big enough and so on ... Is there any way of suppressing the error messages when importstring fails please ?

 

 

TIA

John

 

 

 

René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 26 May 2020 05:20 AM UTC
  2. PowerBuilder
  3. # 1

Hi John,

to catch the error messages implement the itemerror event of the import datawindow/datastore. I think return code 3 could be the best.

HTH,

René

Comment
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Tuesday, 26 May 2020 12:26 PM UTC
  2. PowerBuilder
  3. # 2

to suppress all errors and any other messagebox's from a datawindow set:

dw1.Modify("DataWindow.NoUserPrompt=yes")

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Tuesday, 26 May 2020 20:39 PM UTC
  2. PowerBuilder
  3. # 3

IMHO you don;t want to hide all error messages, you want to hide just the ones related to YOUR function.

Put code in the ITEMERROR event, as suggested by Renee.  Capture the errors you want and allow the others to flow through.


Olan

Comment
  1. John Vanleeuwe
  2. Wednesday, 27 May 2020 03:34 AM UTC
Hi guys,



thanks , but this is EXACTLY what our users want us to do :) ( i think)



Users can copy and paste from 3 different excel spreadsheets, all 3 different where for instance the first column of an excel file can be date, a second one can be string and so on. They don't want to choose the corresponding datawindow that goes along with their ctrl + c from excel. They want our software to "detect" which corresponding datawindow should be set. So i thought to set a boolean in the itemerrorevent .... but unfortunately this doesn't do the trick. Powerbuilder will still try to load the rest of the records , even if one record fails to be imported.



I need a function that returns me "all copied lines" are in fact imported , if yes , then i have the corresponding datawindow. If failure, i need to try with my second external datawindow and so on....



The more i think of this , the more i believe having the user to select his upload format is the way to go. Exactly the manual step they didnt want to do .... hmm stuff to think about...





Thanks

John

  1. Helpful
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Tuesday, 26 May 2020 22:33 PM UTC
  2. PowerBuilder
  3. # 4

Greetings, John - 

How confident can you be that if a trial ImportString produces no errors, that the correct/proper DW Object has been used?

For example, if the first column in the spreadsheet contains text of say, 20 characters or less and the second column is an integer value. You have two possible "import" DW's: One has the first column defined as char(50) and the second column as a number, and updates Table "A". The other import DW has the first column defined as char(20) and the second column as a number and updates Table "B". Or, what if there are no structural differences between two DW's except for which table they update?

The ImportString of the spreadsheet rows will/should work successfully with either DW Object, so which one is the correct one? I realize I'm not privy to all of the details and nuances of what you're attempting to do, but from what you've described I would be reluctant to provide functionality such as what you've described as it might compromise data integrity.

Regards, John

Comment
There are no comments made yet.
Olan Knight Accepted Answer Pending Moderation
  1. Wednesday, 27 May 2020 14:11 PM UTC
  2. PowerBuilder
  3. # 5

>>> Powerbuilder will still try to load the rest of the records , even if one record fails to be imported

Put code in the RetrieveRow event that checks for the error flag. If error exists, then cancel the load.


>>> The more i think of this , the more i believe having the user to select his upload format is the way to go. Exactly the manual step they didnt want to do

<sarcasm>
Tell them with an increase to the project budget you will deliver them the Mind Transfer function, which will not only read their minds to determine which DW to use for the copy & paste, it will do the copy & paste by itself.
</sarcasm>

Sometimes what the user wants cannot be done in a practial manner or in a reasonable amoount of time or ....at all.

Having them choose the upload format is indeed the way to go.


Olan

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.