Hi,
Sorry for the long post.
I need some help again please.
Please tell me if you think my idea is stupid.
I have ± 23 Queues, could be even more or less sometimes.
The Queues are identical but each Queue contains a different set of data.
MyQueue1 Queue,PRE(MyQue1)
MyID Long
MyField1 STRING(255)
MyField2 STRING(255)
MyField3 STRING(255)
END
The other Queues is the same with the same fields just:
MyQueue2 Queue,PRE(MyQue2)
MyQueue3 Queue,PRE(MyQue3)
MyQueue4 Queue,PRE(MyQue4)
MyQueue5 Queue,PRE(MyQue5)
Etc
I loop throught each Queue to create a CSV file.
I use StringTheory
IF RECORDS(MyQueue1) > 0
LOOP X# = 1 TO RECORDS(MyQueue1)
GET(MyQueue1,X#)
ST.SetValue('"'&CLIP(MyQue1:MyID)&'","'&CLIP(MyQue1:MyField1)&'","'&CLIP(MyQue1:MyField2)&'","'&CLIP(MyQue1:MyField3)&'"'&'<13,10>')
ST.SaveFile('MyFirstQ.csv',TRUE)
END
END
IF RECORDS(MyQueue2) > 0
LOOP X# = 1 TO RECORDS(MyQueue2)
GET(MyQueue2,X#)
ST.SetValue('"'&CLIP(MyQue2:MyID)&'","'&CLIP(MyQue2:MyField1)&'","'&CLIP(MyQue2:MyField2)&'","'&CLIP(MyQue2:MyField3)&'"'&'<13,10>')
ST.SaveFile('MySecondQ.csv',TRUE)
END
END
I need to do this for each of the Queues
If I add or remove fields from the Queues I need to go and add or remove the fields from each of the StringTheory SetValue where I assign them.
Is there a way that I can pick up the PreFix of the Queue that I am currently working with and assign it or get it to be something generic?
For instance:
Loc:QPreFix STRING(50)
Loc:QPreFix = GetQueuePrefix
ST.SetValue('"'&CLIP(Loc:QPreFix:MyID)&'","'&CLIP(Loc:QPreFix:MyField1)&'","'&CLIP(Loc:QPreFix:MyField2)&'","'&CLIP(Loc:QPreFix:MyField3)&'"'&'<13,10>')
I can then put the ST.SetValue in a routine.
I then only have to change the ST.SetValue in one place and it will then work for all the Queues.
Something like:
IF RECORDS(MyQueue1) > 0
LOOP X# = 1 TO RECORDS(MyQueue1)
GET(MyQueue1,X#)
Loc:QPreFix = GetQueuePrefix
DO FillSTValues
ST.SaveFile('MyFirstQ.csv',TRUE)
END
END
IF RECORDS(MyQueue2) > 0
LOOP X# = 1 TO RECORDS(MyQueue2)
GET(MyQueue2,X#)
Loc:QPreFix = GetQueuePrefix
DO FillSTValues
ST.SaveFile('MySecondQ.csv',TRUE)
END
END
FillSTValues ROUTINE
ST.SetValue('"'&CLIP(Loc:QPreFix:MyID)&'","'&CLIP(Loc:QPreFix:MyField1)&'","'&CLIP(Loc:QPreFix:MyField2)&'","'&CLIP(Loc:QPreFix:MyField3)&'"'&'<13,10>')