-1

I am uploading a CSV file of records to check if these records are available in a specific Progress database table.

How do I proceed?

Tom Bascom
  • 13,405
  • 2
  • 27
  • 33
Raja
  • 1
  • 2

1 Answers1

2

Assuming a lot of things here since you're not specifying very much.

Assuming we have a file containing animal id's, one per row:

file.csv
=========
1
2
3

Assuming we have a database table called animals with fields id and animalName we can do this (a very naive approach - assuming input data is well formatted, no error checking etc):

/* Define a temp-table to store the file data in*/
DEFINE TEMP-TABLE ttAnimal NO-UNDO
    FIELD id AS INTEGER.


/* Input from files */
INPUT FROM VALUE("c:\temp\file.csv").
REPEAT:

    /* Assumption: the data is clean and well formatted! */
    CREATE ttAnimal.
    IMPORT ttAnimal.


END.
INPUT CLOSE.

/* 
For each animal id read from file. Locate database record and display 
the name */
FOR EACH ttAnimal:

    FIND FIRST animal NO-LOCK WHERE animal.id = ttAnimal.id NO-ERROR.
    IF AVAILABLE animal THEN DO:
        DISP animal.animalName.
    END.

END.
Jensd
  • 7,886
  • 2
  • 28
  • 37