Focal Point
[SOLVED] make a field into a date format

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1681096403

October 30, 2008, 01:38 PM
solowkoe
[SOLVED] make a field into a date format
I am new to webFOCUS, so this might be easy. I am makeing a graph with a across field. I am trying to get that field to sort as a date instead of integer. the current date format looks like this: "2008-10" My questions is how and where do i declare that its a date and not a integer?

thanks for any help
-C

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


Charles P

WebFOCUS 7.1.4
Win XP Pro 2002
service pack 3
October 30, 2008, 01:52 PM
Francis Mariani
If your date field is an integer, this should work:

DEFINE FILE ...
D2/I6YYM = D1;
END

Convert the integer to an integer with Year/Month format.


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 30, 2008, 02:14 PM
solowkoe
thanks.

does it matter where i put the code in?

D2 is the field i want to change right?

and it makes a variable d1 and i refrence the D1 in my across?

what does define file ...? do i replace the ... with the name of my choice?


Charles P

WebFOCUS 7.1.4
Win XP Pro 2002
service pack 3
October 30, 2008, 02:21 PM
solowkoe
quote:
DEFINE FILE ...
D2/I6YYM = D1;
END


I couldnt get it to work. This what the code for my graph looks like:

GRAPH FILE SQLOUT
SUM VISITS PROCEDURE PERCENTAGE
ACROSS E07
BY INV_PROV_NAME

i want to change E07 from int to format YYM so that it sorts correctly.

I tried to put your code at the top just below my SQL and i tried diffrent varaiations that look like this:
DEFINE FILE DATE
E07/I6YYM = D1;
END


Charles P

WebFOCUS 7.1.4
Win XP Pro 2002
service pack 3
October 30, 2008, 02:53 PM
FrankDutch
It's the other way around Charles...

DEFINE FILE SQLOUT
NEWDATE/I6YYM=E07;
END
GRAPH FILE SQLOUT
SUM VISITS PROCEDURE PERCENTAGE
ACROSS NEWDATE
BY INV_PROV_NAME
.....
END


Maybe you should ask your management to let you start with some training.
The software you trying to use is very strong and not very cheap, so some extra investment in training and reading documentation is not a wast of money....




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

October 30, 2008, 04:39 PM
solowkoe
i have had training, but it was in report painter. which is not very versatile. i wouldn't really call this strong. I even had a tech support guy tell me that some of things that i can do cant even be done with report painter.

i've had training, i've got manuels and books, but lets face it, this technology isn't very straight forward

by the way, thanks for your help


Charles P

WebFOCUS 7.1.4
Win XP Pro 2002
service pack 3
October 30, 2008, 04:47 PM
solowkoe
i get the following error when i insert your code:

0 ERROR AT OR NEAR LINE 294 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC282) RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD:
NEWDATE
0 ERROR AT OR NEAR LINE 298 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC003) THE FIELDNAME IS NOT RECOGNIZED: NEWDATE
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT


Charles P

WebFOCUS 7.1.4
Win XP Pro 2002
service pack 3
October 30, 2008, 04:54 PM
FrankDutch
But also in report painter you can create defined fields (click on the calculator icon).
Also in other languages like VisualBasic you need to create your fields before you can use them.
And if you use the GUI you have the help button that might give you the needed suggestions.

C++ or other languages need more time and experience than 2 or 3 days training.
I use this for over 20 years (coding, without the GUI) and there is not much that you can not build with webfocus....




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

October 30, 2008, 05:11 PM
FrankDutch
Difficult to say what the exact reason for this error is without knowing a bit more.

You have a big FEX that creates an SQLOUT file.
I suppose your E07 fields is an A10 (could also be A8)
You need to convert that to a date field like I6YYM, but that can not be done in one command.

Try this

DEFINE FILE SQLOUT
AYEAR/A4=EDIT(E07,'9999'); 
-* this selects only the removes the '-10' from the string '2008-10'
AMONTH/A2=EDIT(E07,'$$$$$99');
-* removes '2008-'
NEWALPHADATE/A8YYMD=AYEAR||AMONTH||'01';
-* concatenate the year and month plus the first day so you get a full date in Alpha format.
-* now you can use several converting formulas to create a smartdate...  
END






Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

October 31, 2008, 10:23 AM
PBrightwell
Charles,

Are you manipulating a file prior to the graph and creating a holdfile? If yo are, open your code and put a ?FF HOLD (or whatever you called it) and get the file format.


Pat
WF 7.6.8, AIX, AS400, NT
AS400 FOCUS, AIX FOCUS,
Oracle, DB2, JDE, Lotus Notes