briprogram
MIS
In the following example the table of column converted.ndcnum is checked for a value. In one particular row of data in the table just this value is missing which causes the fputs not to write to the text file any further in the do while loop. lc_lastndc = ALLTRIM(converted.ndcnum) equal to ""
when the pgm returns to the
IF converted.status = "NEED" .and. ALLTRIM(converted.cfndc) <> lc_lastndc
the
converted.cfndc = "234578003" and lc_lastndc = ""
and it won't enter the if statement. No they are not equal but what keeps the if statement from running?
I am trying to understand why can't foxpro see that they are not equal. This is someone elses code and I am trying to figure what the person was trying to accomplish and what <b>""</b> means.
CODE:
local ln_FileHandle, ln_Position, ln_retval
ln_FileHandle = FCREATE(gc_convertarea + 'loadcf_' + TRIM(THISFORM.otb_shortname.value) +'.txt',0)
ln_Position = FSEEK(ln_FileHandle, 0) && Move the file pointer to BOF
*** OnDemand Header File Info
ln_RetVal = FPUTS( ln_FileHandle, "LOAD DATA" )
ln_RetVal = FPUTS( ln_FileHandle, "INFILE *" )
ln_RetVal = FPUTS( ln_FileHandle, "APPEND" )
ln_RetVal = FPUTS( ln_FileHandle, "INTO TABLE Item" )
ln_RetVal = FPUTS( ln_FileHandle, "FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '" + '"' + "'" )
ln_RetVal = FPUTS( ln_FileHandle, "TRAILING NULLCOLS" )
ln_RetVal = FPUTS( ln_FileHandle, "(Item,NDC,Name,Manufacturer)" )
ln_RetVal = FPUTS( ln_FileHandle, "BEGINDATA" )
LOCAL lc_lastndc
lc_lastndc = " "
SELECT converted
GOTO TOP
DO WHILE ! EOF()
IF converted.status = "NEED" .and. ALLTRIM(converted.cfndc) <> lc_lastndc
ln_RetVal = FPUTS( ln_FileHandle, ALLTRIM(converted.sitecode) + "," + ALLTRIM(converted.cfndc) + "," + ALLTRIM(converted.custdesc) + ",UNKNOWN" )
lc_lastndc = ALLTRIM(converted.ndcnum)
ENDIF
SELECT converted
SKIP
ENDDO
ln_retval = FCLOSE( ln_FileHandle )
A programmer is a red-eyed mumbling mammel capable of conversing with inanimate objects.
when the pgm returns to the
IF converted.status = "NEED" .and. ALLTRIM(converted.cfndc) <> lc_lastndc
the
converted.cfndc = "234578003" and lc_lastndc = ""
and it won't enter the if statement. No they are not equal but what keeps the if statement from running?
I am trying to understand why can't foxpro see that they are not equal. This is someone elses code and I am trying to figure what the person was trying to accomplish and what <b>""</b> means.
CODE:
local ln_FileHandle, ln_Position, ln_retval
ln_FileHandle = FCREATE(gc_convertarea + 'loadcf_' + TRIM(THISFORM.otb_shortname.value) +'.txt',0)
ln_Position = FSEEK(ln_FileHandle, 0) && Move the file pointer to BOF
*** OnDemand Header File Info
ln_RetVal = FPUTS( ln_FileHandle, "LOAD DATA" )
ln_RetVal = FPUTS( ln_FileHandle, "INFILE *" )
ln_RetVal = FPUTS( ln_FileHandle, "APPEND" )
ln_RetVal = FPUTS( ln_FileHandle, "INTO TABLE Item" )
ln_RetVal = FPUTS( ln_FileHandle, "FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '" + '"' + "'" )
ln_RetVal = FPUTS( ln_FileHandle, "TRAILING NULLCOLS" )
ln_RetVal = FPUTS( ln_FileHandle, "(Item,NDC,Name,Manufacturer)" )
ln_RetVal = FPUTS( ln_FileHandle, "BEGINDATA" )
LOCAL lc_lastndc
lc_lastndc = " "
SELECT converted
GOTO TOP
DO WHILE ! EOF()
IF converted.status = "NEED" .and. ALLTRIM(converted.cfndc) <> lc_lastndc
ln_RetVal = FPUTS( ln_FileHandle, ALLTRIM(converted.sitecode) + "," + ALLTRIM(converted.cfndc) + "," + ALLTRIM(converted.custdesc) + ",UNKNOWN" )
lc_lastndc = ALLTRIM(converted.ndcnum)
ENDIF
SELECT converted
SKIP
ENDDO
ln_retval = FCLOSE( ln_FileHandle )
A programmer is a red-eyed mumbling mammel capable of conversing with inanimate objects.