Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi

Read-Only Read-Only Topic
Go
Search
Notify
Tools
About order by
 Login/Join
 
Gold member
posted
time
2008-01
2007-01
2008-04
2009-01

TABLE FILE SQLOUT
PRINT *
COMPUTE NEW521/A4 = SUBSTR(15, time, 1, 4, 4, NEW521);
COMPUTE NEW522/A2 = SUBSTR(15, time, 6, 7, 2, NEW522);
COMPUTE timetest/I6MTYY=EDIT (NEW522||NEW521) ;
BY timetest
END
-RUN


the result :

JAN 07
JAN 08
JAN 09
APR 08


How can i get the result like below :

JAN 07
JAN 08
APR 08
JAN 09


Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
 
Posts: 97 | Registered: August 18, 2009Report This Post
<JG>
posted
Time (I think you mean date) should be in a date format.
Then use BY TIME NOPRINT BY TIMETEST
 
Report This Post
Virtuoso
posted Hide Post
Yang,

You can convert your year-month field to a FOCUS MTYY format:

  
-* File yangyang1.feX
FILEDEF YANG DISK YANG.FTM
-RUN
-WRITE YANG 2008-01
-WRITE YANG 2007-01
-WRITE YANG 2008-04
-WRITE YANG 2009-01
-RUN
EX -LINES 4 EDAPUT MASTER,YANG,C,MEM
 FILENAME=YANG    , SUFFIX=FIX
 SEGMENT=YANG, SEGTYPE=S0
 FIELDNAME=DT,  ALIAS=DT,  USAGE=A7, ACTUAL=A7, $
-RUN
DEFINE FILE YANG
ADT/A6YYM=EDIT(DT,'9999$99');
FDT/MTYY=ADT;
END
TABLE FILE YANG
BY FDT
END

Then sort is natural.


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Gold member
posted Hide Post
Why don't you try:

TABLE FILE SQLOUT
PRINT *
BY time
END
-RUN


WF 7.6.9
PMF 5.1.3
BID 7.6.9

Win XP
HTML, PDF, Excel, PowerPoint
 
Posts: 69 | Location: Germany | Registered: September 21, 2009Report This Post
Expert
posted Hide Post
The reason the output is in this order is you are using an integer for the month/year.

The MTYY is just for output foratting.

You are sorting

012008
012007
042008
012009

You have several options, JG's is the easiest.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

 
Posts: 6349 | Location: 33°49'23.0"S, 151°11'41.0"E | Registered: October 31, 2006Report This Post
Gold member
posted Hide Post
Thanks JG

BY TIMETEST
BY TIME NOPRINT

this is ok,
but i use it in crete graph,
in the graph , it's not work well...
so i want use BY TIMETEST one time .
,
Thanks Danny-SRL ,
Thanks Stefan ,
Thanks Waz ,


i will try again , thanks all , Smiler

Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
 
Posts: 97 | Registered: August 18, 2009Report This Post
Gold member
posted Hide Post
Hi Danny-SRL , thanks your replied.

i used your code,

DEFINE FILE YANG
ADT/A6YYM=EDIT(DT,'9999$99');
FDT/MTYY=ADT;
END
TABLE FILE YANG
BY FDT
END


i can get the :
JAN, 2007
JAN, 2008
APR, 2008
JAN, 2009


so , how to remove the "," to get the [JAN 2007] with natural sort


Thanks,
Yang

This message has been edited. Last edited by: Yangyang,


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
 
Posts: 97 | Registered: August 18, 2009Report This Post
Virtuoso
posted Hide Post
Try this:
DEFINE FILE YANG
ADT/A6YYM=EDIT(DT,'9999$99');
ALFA/A17 = CHGDAT('YYM', 'MYYT', ADT, 'A17');
FDT/MTYY=ADT;
END
TABLE FILE YANG
PRINT ADT ALFA BY FDT
END


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
 
Posts: 1961 | Location: Netherlands | Registered: September 25, 2007Report This Post
Gold member
posted Hide Post
Thanks GamP

actually , i want to use this in create Graph.

so i want to order by time(JAN 2007)

if it is "A17" , i think the sort is jumbled .

i used the Danny-SRL's code , it's ok except "," ...



Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
 
Posts: 97 | Registered: August 18, 2009Report This Post
Expert
posted Hide Post
quote:
i used the Danny-SRL's code , it's ok except "," ...
The comma is part of that date format (MTYY) it is also grammatically correct even if it does extend the value by one extra character.

If you want the comma removed you will will have to control the sort order yourself using BY fieldname COLUMNS 'JAN 2007' AND ..... etc.

Check out the documentation so that you understand it fully before trying to use it.

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Virtuoso
posted Hide Post
quote:
The comma is part of that date format (MTYY) it is also grammatically correct


And then the possible aesthetical problem of an additional comma far outweigh the complexity of
BY sortfield ROWS val1 OR val2 ...

and of
ACROSS sortfield COLUMNS val1 AND val2 ...


Daniel
In Focus since 1982
wf 8.202M/Win10/IIS/SSA - WrapApp Front End for WF

 
Posts: 1980 | Location: Tel Aviv, Israel | Registered: March 23, 2006Report This Post
Expert
posted Hide Post
Ooooooooooooh, so true! Wink

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 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Gold member
posted Hide Post
Thanks all .

: )


Thanks,
Yang


WebFOCUS 7.6.8
WebFOCUS 7.6.10
BI
FLEX
.NET
 
Posts: 97 | Registered: August 18, 2009Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic


Copyright © 1996-2020 Information Builders