Help with import command

Walter Vaughan Jr wvaughan at steelerubber.com
Fri Apr 23 11:00:36 PDT 2021


I dunno. 

It looks to me like you are getting a json file, and I'll admit I am the worlds worst on them. However, they have no special power.

I would either run it through a JSON converter to make it into something more importable with filePro16 or just read each line in a loop
 
1) read each line separately
2) INSTR (InString) to find the equals sign and then
3) Left$ to get the key value
4) Right$ to get the data value
5) Put the values where you need

Not as clean as what you are trying to do, but at least you can put in error checking at a lower level.

If you insist on doing it your way, I'd be looking hard at a hex dump of the file. What are you really getting for end of line and end of data block values. #x0d, #x0a or just single line feeds?





-----Original Message-----
From: Filepro-list <filepro-list-bounces+wvaughan=steelerubber.com at lists.celestial.com> On Behalf Of Richard Kreiss via Filepro-list
Sent: Friday, April 23, 2021 11:11 AM
To: 'filepro-list at lists.celestial.com' <filepro-list at lists.celestial.com>
Subject: Help with import command

Below is the file I am trying to import:

response=1
responsetext=SUCCESS
authcode=123456
transactionid=6174664263
avsresponse=
cvvresponse=M
orderid=
type=sale
response_code=100

The import processing:
      ◄ If:
      Then: import ASCII field=(ifile) o=& c== r== f=&
17  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:         NOT field
      Then:         ERRORBOX "(17) Done reading the file\nThe counter Ct is at
18  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:
      Then:         ct=ct+"1"
19  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:
      Then:         im=field(1)
20  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:         IM CO CHR("124")
      Then:         gosub RMV_124;goto DO_FIEL
21  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:         CT LT "20"
      Then: goto DO_FIEL
22  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
do_fiel◄ If: '*****************************************************************
      Then: '* routine to set fierld values
23  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If: ct = "1" or ct = "5" or ct = "7" or ct= "9" or ct = "12" or ct = "
      Then: MSGBOX "The Value of im is \b5"<im<"\nThe counter is at \b6"<ct<"\
24  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If: im="response"        'loop back to get the value of the "response"
      Then: il=im;im="";GOTO get_Imp   'whici is usually a single digit number
25  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If: il="Response"                 'value of response in in field
      Then: fields["1"]=im;il="";im="";GOTO get_imp   'im usually a single num
26  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If: im="Success"
      Then: fields["2"]=im;il="";im="";GOTO get_imp   'im usually a single num
27  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If: 'im ="responsetext"
      Then: 'il=im;CT="3";goto GET_Imp

Problem is tht the import works properly foe the first two imports but then skips the the value to the left of the equal = sign.

The first import is response (correct) and the second is 1.  The issue I am having is that the next value imported is Success and not Responsetext. This is happening with each import, the value to expected is not the “header” but the value of the header.(the value to the right of the equal sign =).

Does anyone have an answer as to why I am having this problem and how for fix it?


Richard Kreiss
GCC Consulting



-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 19645 bytes
Desc: not available
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20210423/734166c7/attachment.bin>
_______________________________________________
Filepro-list mailing list
Filepro-list at lists.celestial.com
Subscribe/Unsubscribe/Subscription Changes http://mailman.celestial.com/mailman/listinfo/filepro-list


More information about the Filepro-list mailing list