Table IO update delay

jpsst34

Well Known Member
Hey List,

I am currently trying to write a table conversion that reads the contents of a custom table and outputs the data to one of two text files - which file it writes to is based on the value of one field in the table. Before I can output to text, I have to key into one table, get a value and update the other table with that value. Then, I check the new value in the updated table and based on that I update one of the two text files.

The problem I am seeing is that it seems to be checking the value in the updated table before the update command has completed. For instance, if this value is "N" for every record, but then updated to "Y" for every record, the data is output to the file corresponding to "N." But if I look at the table that was updated, this field is "Y" for every record. This leads me to believe that the program is continuing on before the data is actually updated.

Below is the ER Code of my program. Please feel free to read it and let me know anything you may have that explains why I'm seeing this behaviour. Is it due to my suspicion that the program is moving on before the update is done?


In the Row Fetched event of the TC:

// Before we can output anything to the CR flat files, we must first key into
// the F0101Z2 table on EDUS, EDBT, EDTN, and EDLN to get the EDSP
// value and update F550103.EDSP
F0101Z2.Fetch Single
.....IC EDI - User ID = TK EDI - User ID
.....IC EDI - Batch Numerb = TK EDI Batch Number
.....IC EDI - Transaction Number = TK EDI - Transaction Number
.....IC EDI - Line Number = TK EDI - Line Number
.....VA rpt_UpdatedEDSP <- TK EDI - Successfully Processed
F550103.Update
.....VA rpt_UpdatedEDSP -> TK EDI - Successfully Processed
.....IC Long Address Number = TK Long Address Number
// OK, we've updated the F550103.EDSP so we can output the record
If SV File_IO_Status is equal to CO SUCCESS
If VA rpt_UpdatedEDSP is equal to "Y"
// If the records was uploaded into the Address Book, output it to Vendors_CR.tx
OC EDUS (TextLine1) = IC EDUS (EDI - User ID) (F550103)
OC EDTN (TextLine1) = IC EDTN (EDI - Transaction Number) (F550103)
OC EDLN (TextLine1) = IC EDLN (EDI - Line Number) (F550103)
OC EDSP (TextLine1) = [IC EDSP (EDI - Successfully Processed) (F550103)]
OC TNAC (TextLine1) = IC TNAC (Transaction Action) (F550103)
OC EDBT (TextLine1) = IC EDBT (EDI - Batch Number) (F550103)
OC ALPH (TextLine1) = IC ALPH (Name - Alpha) (F550103)
OC MLNM (TextLine1) = IC MLNM (Name - Mailing) (F550103)
OC ADD1 (TextLine1) = IC ADD1 (Address Line 1) (F550103)
OC ADD2 (TextLine1) = IC ADD2 (Address Line 2) (F550103)
OC ADD3 (TextLine1) = IC ADD3 (Address Line 3) (F550103)
OC ADD4 (TextLine1) = IC ADD4 (Address Line 4) (F550103)
OC CTY1 (TextLine1) = IC CTY1 (City) (F550103)
OC ADDS (TextLine1) = IC ADDS (State) (F550103)
OC ADDZ (TextLine1) = IC ADDZ (Postal Code) (F550103)
OC CTR (TextLine1) = IC CTR (Country) (F550103)
OC ATP (TextLine1) = [IC ATP (Address Type - Payables) (F550103)]
OC TAXC (TextLine1) = [IC TAXC (Person/Corporation Code) (F550103)]
OC AC07 (TextLine1) = IC AC07 (1099 Reporting Codes) (F550103)
OC TAX (TextLine1) = IC TAX (Tax ID) (F550103)
OC ALKY (TextLine1) = IC ALKY (Long Address Number) (F550103)
OC AN8 (TextLine1) = IC AN8 (Address Number Test) (F550103)
OC AC30 (TextLine1) = IC AC30 (Category Code - Address Book 30) (F550103)
OC AC06 (TextLine1) = IC AC06 (Category Code - Address Book 06) (F550103)
OC SIC (TextLine1) = IC SIC (Industry Classification Code) (F550103)
OC AC08 (TextLine1) = IC AC08 (Category Code - Address Book 08) (F550103)
TextLine1.Insert Row
Else
// If it wasn't uploaded into AB, output it to Vendors_CR_NotPopulated.txt
OC EDUS (TextLine1) = IC EDUS (EDI - User ID) (F550103)
OC EDTN (TextLine1) = IC EDTN (EDI - Transaction Number) (F550103)
OC EDLN (TextLine1) = IC EDLN (EDI - Line Number) (F550103)
OC EDSP (TextLine1) = [IC EDSP (EDI - Successfully Processed) (F550103)]
OC TNAC (TextLine1) = IC TNAC (Transaction Action) (F550103)
OC EDBT (TextLine1) = IC EDBT (EDI - Batch Number) (F550103)
OC ALPH (TextLine1) = IC ALPH (Name - Alpha) (F550103)
OC MLNM (TextLine1) = IC MLNM (Name - Mailing) (F550103)
OC ADD1 (TextLine1) = IC ADD1 (Address Line 1) (F550103)
OC ADD2 (TextLine1) = IC ADD2 (Address Line 2) (F550103)
OC ADD3 (TextLine1) = IC ADD3 (Address Line 3) (F550103)
OC ADD4 (TextLine1) = IC ADD4 (Address Line 4) (F550103)
OC CTY1 (TextLine1) = IC CTY1 (City) (F550103)
OC ADDS (TextLine1) = IC ADDS (State) (F550103)
OC ADDZ (TextLine1) = IC ADDZ (Postal Code) (F550103)
OC CTR (TextLine1) = IC CTR (Country) (F550103)
OC ATP (TextLine1) = [IC ATP (Address Type - Payables) (F550103)]
OC TAXC (TextLine1) = [IC TAXC (Person/Corporation Code) (F550103)]
OC AC07 (TextLine1) = IC AC07 (1099 Reporting Codes) (F550103)
OC TAX (TextLine1) = IC TAX (Tax ID) (F550103)
OC ALKY (TextLine1) = IC ALKY (Long Address Number) (F550103)
OC AN8 (TextLine1) = IC AN8 (Address Number Test) (F550103)
OC AC30 (TextLine1) = IC AC30 (Category Code - Address Book 30) (F550103)
OC AC06 (TextLine1) = IC AC06 (Category Code - Address Book 06) (F550103)
OC SIC (TextLine1) = IC SIC (Industry Classification Code) (F550103)
OC AC08 (TextLine1) = IC AC08 (Category Code - Address Book 08) (F550103)
TextLine1.Insert Row
End If
Else
End If


Thanks,
 
I figured out the reasoning, with the help of another developer here (thanks, Vivek)...

I didn't realize that all of the IC values have already been read at the beginning of the Row Fetched event, before any of my ER are processed. Thus, my Update statement acually occured after the read of the EDSP field, not before. I did not know that.

So the anwer is "No, the program is not moving on before the Update completes." The update occurs after the IC EDSP is read.


Cheers,
 
Hi,

This update delay may also be sometimes due to channel synchronisation.
You can give a try like this, you can give while loop before you are checking with the updated record to see that it has updated.
you open a while loop and fetch some value giving reference your updated record, then you will achieve the result what you want to have.
It may take time, or it may hang sometimes because of that while loop.

its a suggestion, ive tried this in two three places, it works
 
Back
Top