Thanks for your help ahead.This message has been edited. Last edited by: junjie,
Thank you
Jun Jie Best Regards ^^^^^^^^^^^^^^^^ Join Focal Point in June 2017 WebFOCUS 8 windows 7, HTML and PDF
July 04, 2017, 04:25 AM
Pravin.Singh
Hi Junjie,
You can use the below piece of code: TABLE FILE X PRINT S/N CHILD_ID FATHER_ID BY FATHER_ID NOPRINT END
NOPRINT should help you with maintaining the order of columns. If you are looking for something else, please explain more.
Thanks, Pravin
WebFOCUS 7703 Windows, All Outputs pravinsinghwebfocus.blogspot.com
July 04, 2017, 04:30 AM
junjie
Hi Pravin, Thanks for your fast reply.
Actually what I wanted is how to get below kind of serial number: 1a 1b 1c 2a 2b 3a 3b 3c
Thank you
Jun Jie Best Regards ^^^^^^^^^^^^^^^^ Join Focal Point in June 2017 WebFOCUS 8 windows 7, HTML and PDF
July 04, 2017, 04:36 AM
Tony A
Hi and welcome to Focal Point.
What you need to do is order your records by the one that you wish to serialise - e.g. Father_ID -
-* The first portion of the code creates a temporary file containing your data
EX -LINES * EDAPUT MASTER,junjie,CV,FILE
FILENAME=junjie, SUFFIX=FOC
SEGNAME=SEG01, $
FIELDNAME=Father_ID, ,A9,A9,$
FIELDNAME=Child_ID, ,A9,A9,$
EDAPUT*
-RUN
CREATE FILE junjie
MODIFY FILE junjie
DATA
Father A,Child A,$
Father A,Child B,$
Father A,Child C,$
Father B,Child D,$
Father B,Child E,$
Father C,Child D,$
Father C,Child F,$
END
-RUN
TABLE FILE junjie
SUM COMPUTE CNTR/I3 = IF Father_ID EQ LAST Father_ID THEN LAST CNTR ELSE LAST CNTR + 1; NOPRINT
COMPUTE SUFF_I/I3 = IF Father_ID NE LAST Father_ID THEN 97 ELSE LAST SUFF_I + 1; NOPRINT
COMPUTE Serial_ID/A6 =LJUST(6,FPRINT(CNTR,'I3','A3')||HEXBYT(SUFF_I,'A3'),'A6');
BY Father_ID
BY Child_ID
END
-RUN
Good luck
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
July 04, 2017, 05:12 AM
junjie
Hi Tony,
Appreciate your effort. Below codes work for me perfectly.
TABLE FILE junjie SUM COMPUTE CNTR/I3 = IF Father_ID EQ LAST Father_ID THEN LAST CNTR ELSE LAST CNTR + 1; NOPRINT COMPUTE SUFF_I/I3 = IF Father_ID NE LAST Father_ID THEN 97 ELSE LAST SUFF_I + 1; NOPRINT COMPUTE Serial_ID/A6 =LJUST(6,FPRINT(CNTR,'I3','A3')||HEXBYT(SUFF_I,'A3'),'A6'); BY Father_ID BY Child_ID END -RUN
But I encountered error when I tried to run below codes to create dummy data, The error message is: Cannot include resource specified IBFS:/-LINES -* The first portion of the code creates a temporary file containing your data EX -LINES * EDAPUT MASTER,junjie,CV,FILE FILENAME=junjie, SUFFIX=FOC SEGNAME=SEG01, $ FIELDNAME=Father_ID, ,A9,A9,$ FIELDNAME=Child_ID, ,A9,A9,$ EDAPUT* -RUN
CREATE FILE junjie MODIFY FILE junjie DATA Father A,Child A,$ Father A,Child B,$ Father A,Child C,$ Father B,Child D,$ Father B,Child E,$ Father C,Child D,$ Father C,Child F,$ END -RUN
Could you help me on this as well so that I can create dummy data for test purpose in the near future.
Thank you
Jun Jie Best Regards ^^^^^^^^^^^^^^^^ Join Focal Point in June 2017 WebFOCUS 8 windows 7, HTML and PDF
July 04, 2017, 05:18 AM
Tony A
Hi Junjie,
That error is because you are executing this from a content folder whereas I created the example within an application folder.
To resolve this in a content folder scenario, just prefix the line EX - LINES with -MRNOEDIT EX -LINES etc.
If you want to learn about creating temporary test data, search the forum for examples and you will find many. a possible search would be on EDAPUT.
Also keep the Tech Library document URL to hand - Link to 8.1 Docs
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10
July 04, 2017, 05:31 AM
junjie
Hi Tony,
You are great, it's working fine after I added the prefix -MRNOEDIT you mentioned.
Thank you so much for pointing out the resource URL, it very useful not only for me, also for those who will see this post in the future.
This question can be remarked as SOLVED.
Thank you
Jun Jie Best Regards ^^^^^^^^^^^^^^^^ Join Focal Point in June 2017 WebFOCUS 8 windows 7, HTML and PDF
July 04, 2017, 05:33 AM
Tony A
Hi Junjie,
You should mark this post as solved by editing your very first text where you will be able to change the subject.
Just add [SOLVED} to the beginning of the subject line.
T
In FOCUS since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2
WebFOCUS App Studio 8.2.06 standalone on Windows 10