1. Kiat Chun
  2. PowerBuilder
  3. Wednesday, 17 October 2018 16:41 PM UTC

Hi, I need some help with Appeon PB R3 deploying as simple standalone application.

I have two DataStore objects of type (Tabular, external source)

I have a program that uses ImportFile() function to import 3,900 rows from a CSV file (UTF-8) into the first DataStore.

(also tested using visual datawindow control, all 3900 rows imported successfully, with data).

I would like to loop through every row in the first DataStore, check for Country field. If it matches I want to InsertRow() into a second DataStore, and SetItem() values on several columns in the second DataStore.

Finally to SaveAs() CSV the second datastore.

I know in the source CSV file there are more than 500 matches with data.

However every time I execute the code, I only get data populated up to 165 rows in the second CSV file, all the rest are blank.

Opening the CSV file in Excel, I only see 165 rows, but in Notepas, I see blank rows with commas.

Am I missing something ?

Code Sample:

//CSV filepath obtained using GetFileOpenName () function

ll_import = dstore_1.ImportFile (CSV!, is_pathname, 2)
 
 IF ll_import > 0 THEN
   dstore_2.Reset ()
   DO
      ll_row ++
      IF dstore_1.GetItemString (ll_row, "country") = "ABC" THEN
          dstore_2.InsertRow (0)
          dstore_2.SetItem (ll_row, "origin_country", "ABC")

     END IF

    LOOP UNTIL ll_row = ll_import

END IF

Any advice greatly appreciated. Thanks

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 17 October 2018 17:05 PM UTC
  2. PowerBuilder
  3. # 1

Hi Kiat;

 Change your script to ...

     IF dstore_1.GetItemString (ll_row, "country") = "ABC" THEN
          ll_row2 = dstore_2.InsertRow (0)
          dstore_2.SetItem (ll_row2, "origin_country", "ABC")
     END IF

HTH

Regards .. Chris

Comment
  1. Kiat Chun
  2. Wednesday, 17 October 2018 23:22 PM UTC
Wow! thank you, you're a legend. It is working now.

My bad, I overlooked the gap in between the rows in 2nd datastore.
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 18 October 2018 13:06 PM UTC
Hi Kiat;

Excellent news ... glad that you got it working!

Regards ... Chris
  1. Helpful
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.