I have a pascal script, which basically pushes information into a 3rd party system.
I have an excel macro written, which saves raw data into a CSV file, which I would like my script to read, and take the data (each row is 1 record) and put each portion in a specific field (setValue)
I cannot seem to find a way to do this (I am able to do this in a single field) but am unsure how to have 444,555,666 work so 444 goes here, 555 goes here, etc. into my 3rd party program.

The VBA (works great no issue) however the script to read it is where I keep getting stuck.
The set values below work fine with this 3rd party program, but I cannot seem to get it to read the CSV.

Program TEST;

VAR

//start the loop here

begin
//Constants per file
setValue('invoice_Type','1');
SetValue('billed_Date',FormatDateTime('dd/mm/yy', Now()+10));
setValue('post_Date6','*'); 
setValue('time_Text6','*');
setValue('trace_Type1','MB')
setValue('trace_Type2','MF')
setValue('trace_Type3','PO')
setValue('ship_Type','F');
setValue('man_Unit','PCS');
setValue('voy_Flt_Date','*');
setValue('trace_Date1','*');
setvalue('trace_No1','000-NA-A');
//end of constants

//FIELDS I NEED TO ADD DATA FROM MY CSV
setvalue('client_INFO','');
setvalue('client_No_LETTER','');
setValue('man_Qty','');
setValue('trace_Qty1','');

DoAction('PF6'); //Shipment History

    While FormName = 'askimportctxcontroller' do
    begin
    SetValue('DEFAULT_ANSWER','Y');
    DoAction('Enter');
    end;

doAction('PF1');        //update
doAction('PF8');        //exit 
doAction('PF7');        //other
doAction('PF4');        //send 

//end log

doAction('PF3');        //clear

//end the loop here

end.

anyone? please need some guidance.

Program TEST;

VAR
origin : string;
carrier : string;
fl_data : TTextFile;

//Open CSV File and get ready to read
    AssignFile(fl_data,'c:\INPUTFILE.csv');
    Reset(fl_data);

//make sure the screen is clear

doAction('PF3');  //clear screen    

//start the loop here
begin
//Constants per file set these right away
setValue('invoice_Type','1');
SetValue('billed_Date',FormatDateTime('dd/mm/yy', Now()+10));
setValue('consol_Flag','N');
setvalue('carrier','TRK');
setvalue('my_We_Deliver','N');
setValue('local_Clearning','Y');
setvalue('agent_Broker','N');
setValue('express_Flag','N');
SetValue('customs_Category','S')
setValue('post_Date6','*'); 
setValue('time_Text6','*');
setValue('ship_Type','F');
setValue('man_Unit','PCS');
setValue('voy_Flt_Date','*');
setValue('trace_Date1','*');
setvalue('trace_no1','000-NA-A');
//end of constants

// need help here
// next 2 lines below would take the value (if this was a single list of data (not CSV) and put into an invocie screen, I need to be able to use a CSV with 4 positions.
//Each part would go into the below area, but I am not sure how to tell the script to do this
invoice:=Read(fl_data);
        setvalue('invoice_No', invoice);

setvalue('client_No_Cnee',[[1st value]]);
setvalue('client_No_Shpr',[[2nd value]]);
setValue('man_Qty',[[3rd value]]);
setValue('trace_Qty1',[[4th value]]);

//ends the weight check based on carrier

DoAction('PF6'); //Shipment History

    While FormName = 'askimportctxcontroller' do
    begin
    SetValue('DEFAULT_ANSWER','Y');
    DoAction('Enter');
    end;

// this saves and updates the program   
doAction('PF1');        //update
doAction('PF8');        //exit to main screen
doAction('PF7');        //other
doAction('PF4');        //send to Customs

doAction('PF3');        //clear

//end the loop here

end;
close(fl_data);
end.

CSV consists of data like this:

AAAA,BBBB,CCCC,DDD
EEE,AAA,EEE,DDD etc.

Each of those lines is one file, so first part goes to field 1, then 2 etc,
then cycles to the next.

I take it you elected to dump more code and hope. Read the link again and try to avoid "it doesn't work" posts. I can't tell what it is supposed to do either.

Read that link again about how to make better questions and discussions.

Got your DM. You are expecting me to reverse engineer this which is fine but may not get you many takers.

Explain where you think it fails.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.