mhenson mhenson Posted June 6 Share Posted June 6 I had need to set up a webservice for sales order line text entry, and based it off the ECMSOHTEX.src script. The way it's generating a sequence is relying on 'uniqid': Local Integer NEXTID : NEXTID = 0 ... Read [F:TXC]TXC0 Last NEXTID = uniqid([TXC]) + 1 SOQTEX_0 SOQ~00001332 <- this was made after below, using the standard sage screen SOQ~00014484 <- this was generated using the logic above (except for SOQ) SOQ~00000436 <- this and below were made a long time ago SOQ~00000435 SOQ~00000434 I don't have the source for TRTX3TEX but I see it being used to generate sequences in some other vanilla code files # Get next generated text value Call NUM_TXC(WTABLE, WTEXSEQ, SEQ_RET_STAT) From TRTX3TEX If SEQ_RET_STAT = 0 GEN_BOMTEXT = WTABLE + "~" + format$("N0:8#", num$(WTEXSEQ)) Endif Anybody know? Link to comment Share on other sites More sharing options...
mhenson mhenson Posted June 6 Author Share Posted June 6 Realized I left out most of the question. Is this a key collision waiting to happen, basically. I modified my own code to use the NUM_TXC from TRTX3TEX in either case. Link to comment Share on other sites More sharing options...
Regard Hulsbos Posted June 12 Share Posted June 12 Good day, I have provided a breakdown of the function NUM_TWC from TRTX3TEX in the code section below. It reads the last CLOB text sequence added to a specific table. If no CLOB has been associated with this table, then a new entry is created. If the record already exists, the text sequence counter gets increased and the table gets updated. Hope this helps. ######################################################################### # NUM_TXC: ASSIGNMENT OF A NUMBER IDENTIFYING A CLOB STORED IN TEXCLOB #------------------------------------------------ ----------------------- # WABRFIC: TABLE ABREVIATION TO WHICH THE CLOB IS LINKED # WTEXSEC: SEQUENCE COUNTER OF NUMBER OF CLOBS ALREADY LINED TO TABLE ABREVIATION INDICATED BY VARIABLE WABRFIC # WRETURN: STATUS OF THE NUMBER SEQUENCE FINDER (0 = OK | 99 = ERROR) ######################################################################### Local File TEXCPT [TCC] Readlock [TCC]TCC0 = WABRFIC If fstat <> [V]CST_AOK WTEXSEQ = 1 # WRITE RECORD ENTRY IN TEXCPT FOR FIRST CLOB ASSOCIATED WITH THE TABLE Else WTEXSEQ = [F:TCC]TEXSEQ + 1 # INCRIMENT THE CLOB COUNTER ASSOCIATED WITH THE TABLE Endif LogicClose File [TCC] Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now