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.

Join the TIBCO Community
TIBCO Community is a collaborative space for users to share knowledge and support one another in making the best use of TIBCO products and services. There are several TIBCO WebFOCUS resources in the community.

  • From the Home page, select Predict: WebFOCUS to view articles, questions, and trending articles.
  • Select Products from the top navigation bar, scroll, and then select the TIBCO WebFOCUS product page to view product overview, articles, and discussions.
  • Request access to the private WebFOCUS User Group (login required) to network with fellow members.

Former myibi community members should have received an email on 8/3/22 to activate their user accounts to join the community. Check your Spam folder for the email. Please get in touch with us at community@tibco.com for further assistance. Reference the community FAQ to learn more about the community.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] &TOD to AM PM

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED] &TOD to AM PM
 Login/Join
 
Guru
posted
I am trying to convert TOD to AM PM time. When when I use some -SET commands in my procedure I get an error message. Following are the commands I am issuing but I am getting error message. Where in procedure do I use these SET commands?

 -SET &HOUR = EDIT(&TOD,'99');
-SET &M = IF &HOUR GE 12 THEN ' PM' ELSE ' AM';
-SET &HOUR = IF &HOUR GE 13 THEN &HOUR-12 ELSE IF &HOUR EQ 0 THEN 12 ELSE &HOUR;
-SET &TimeHH     = &HOUR | &M ;
-SET &TimeHHMM   = &HOUR | EDIT(&TOD,'$$$:99') | &M ;
-SET &TimeHHMMSS = &HOUR | EDIT(&TOD,'$$$:99$:99') | &M ;
  

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


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
Plus I want to use this Time in my report fotter.


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Virtuoso
posted Hide Post
quote:
I get an error message


You'll need to be more specific. How about adding the following line just before that piece of code in order to do some basic debugging:
-SET &ECHO=ALL;


After running it, you'll be able to analyze what Dialog Manager is doing and what values your &variables have along the way.

quote:
Plus I want to use this Time in my report fotter.


Just add a reference to your &variable in the FOOTING; you'd probably want to add a spot marker just in case you want to apply specific styling to that value.

TABLE FILE blah
SUM
    blah
FOOTING
"Report Run Time:<+0>&TimeHHMMSS"
..
ON TABLE SET STYLE *
TYPE=FOOTING, LINE=1, ITEM=2, STYLE=BOLD, $
ENDSTYLE
END



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Guru
posted Hide Post
Thanks for helping. I think I just dont know what I am doing. Here is what I was doing and failing.
So how can I use these SET commands in my code?
TABLE FILE CAR
PRINT
'CAR.ORIGIN.COUNTRY'
'CAR.COMP.CAR'
HEADING
""
FOOTING
"&TimeHHMMSS"
-SET &HOUR = EDIT(&TOD,'99');
-SET &M = IF &HOUR GE 12 THEN ' PM' ELSE ' AM';
-SET &HOUR = IF &HOUR GE 13 THEN &HOUR-12 ELSE IF &HOUR EQ 0 THEN 12 ELSE &HOUR;
-SET &TimeHH = &HOUR | &M ;
-SET &TimeHHMM = &HOUR | EDIT(&TOD,'$$$:99') | &M ;
-SET &TimeHHMMSS = &HOUR | EDIT(&TOD,'$$$:99$:99') | &M ;
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Platinum Member
posted Hide Post
Hi Arif,

You should put the -SET commands before the TABLE command.

Best Regards,

Jimmy Pang


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
 
Posts: 117 | Location: Toronto, Ontario, Canada | Registered: February 29, 2008Report This Post
Guru
posted Hide Post
Arif,

Try the code that we use
  
-SET &TESTTIME = &TOD ;
-* USE THE NEXT LINE AT THE END OF YOUR PROCEDURE FOR TIME STAMPING
-SET &HOURX = EDIT(&TESTTIME,'99') ;
-SET &HOUR = IF &HOURX GT 12 THEN &HOURX - 12 ELSE &HOURX ;
-SET &HOUR = IF &HOUR  LT '10' THEN &HOUR ELSE &HOUR ;
-SET &MIN  = EDIT(&TESTTIME,'$$$99') ;
-SET &RPTTIME = IF &HOURX LT '12' THEN &HOUR ||':'|| &MIN | ' AM'
-                                 ELSE &HOUR ||':'|| &MIN | ' PM' ;
-SET &TIMECHK = EDIT(&RPTTIME,'$9') ;
-SET &RPTTIME = IF &TIMECHK EQ ':' THEN '0' || &RPTTIME ELSE &RPTTIME ;
-SET &RPT_START_TIME = HHMMSS(&TOD);


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Guru
posted Hide Post
I am getting error message Error Parsing the data.
 
-SET &TESTTIME = &TOD ;
-* USE THE NEXT LINE AT THE END OF YOUR PROCEDURE FOR TIME STAMPING
-SET &HOURX = EDIT(&TESTTIME,'99') ;
-SET &HOUR = IF &HOURX GT 12 THEN &HOURX - 12 ELSE &HOURX ;
-SET &HOUR = IF &HOUR  LT '10' THEN &HOUR ELSE &HOUR ;
-SET &MIN  = EDIT(&TESTTIME,'$$$99') ;
-SET &RPTTIME = IF &HOURX LT '12' THEN &HOUR ||':'|| &MIN | ' AM'
-                                 ELSE &HOUR ||':'|| &MIN | ' PM' ;
-SET &TIMECHK = EDIT(&RPTTIME,'$9') ;
-SET &RPTTIME = IF &TIMECHK EQ ':' THEN '0' || &RPTTIME ELSE &RPTTIME ;
-SET &RPT_START_TIME = HHMMSS(&TOD);

TABLE FILE CAR
PRINT 
     'CAR.ORIGIN.COUNTRY'
     'CAR.COMP.CAR'
HEADING
""
FOOTING
""
ON TABLE SET PAGE-NUM OFF 
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
     UNITS=IN,
     SQUEEZE=ON,
     ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
     GRID=OFF,
     FONT='ARIAL',
     SIZE=9,
$
TYPE=TITLE,
     STYLE=BOLD,
$
TYPE=TABHEADING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=TABFOOTING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=HEADING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=FOOTING,
     SIZE=12,
     STYLE=BOLD,
$
TYPE=SUBHEAD,
     SIZE=10,
     STYLE=BOLD,
$
TYPE=SUBFOOT,
     SIZE=10,
     STYLE=BOLD,
$
TYPE=SUBTOTAL,
     BACKCOLOR=RGB(210 210 210),
$
TYPE=ACROSSVALUE,
     SIZE=9,
$
TYPE=ACROSSTITLE,
     STYLE=BOLD,
$
TYPE=GRANDTOTAL,
     BACKCOLOR=RGB(210 210 210),
     STYLE=BOLD,
$
ENDSTYLE
END
 


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Virtuoso
posted Hide Post
FOOTING
"&TimeHHMMSS"   <-- This variable is "unknown" at this point
-SET &HOUR = EDIT(&TOD,'99');
-SET &M = IF &HOUR GE 12 THEN ' PM' ELSE ' AM';
-SET &HOUR = IF &HOUR GE 13 THEN &HOUR-12 ELSE IF &HOUR EQ 0 THEN 12 ELSE &HOUR;
-SET &TimeHH = &HOUR | &M ;
-SET &TimeHHMM = &HOUR | EDIT(&TOD,'$$$:99') | &M ;
-SET &TimeHHMMSS = &HOUR | EDIT(&TOD,'$$$:99$:99') | &M ;


Arif, you are attempting to use &TimeHHMMSS in your FOOTING even before Dialog Manager has had a chance to define and assign a value to it.

Please do as Jimmy says and move all of those -SET statement to a place *before* the TABLE FILE statement begins.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Virtuoso
posted Hide Post
quote:
I am getting error message Error Parsing the data.


Where? Confused
What values do each of your variables show?

Please show us *your* debugging work!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
 
Posts: 1533 | Registered: August 12, 2005Report This Post
Guru
posted Hide Post
Again, Thank you for looking into it. I have moved the SET statements before the table file but its still giving me data parsing error message.

 
-SET &TESTTIME = &TOD ;
-* USE THE NEXT LINE AT THE END OF YOUR PROCEDURE FOR TIME STAMPING
-SET &HOURX = EDIT(&TESTTIME,'99') ;
-SET &HOUR = IF &HOURX GT 12 THEN &HOURX - 12 ELSE &HOURX ;
-SET &HOUR = IF &HOUR  LT '10' THEN &HOUR ELSE &HOUR ;
-SET &MIN  = EDIT(&TESTTIME,'$$$99') ;
-SET &RPTTIME = IF &HOURX LT '12' THEN &HOUR ||':'|| &MIN | ' AM'
-                                 ELSE &HOUR ||':'|| &MIN | ' PM' ;
-SET &TIMECHK = EDIT(&RPTTIME,'$9') ;
-SET &RPTTIME = IF &TIMECHK EQ ':' THEN '0' || &RPTTIME ELSE &RPTTIME ;
-SET &RPT_START_TIME = HHMMSS(&TOD);

TABLE FILE CAR
PRINT 
     'CAR.ORIGIN.COUNTRY'
     'CAR.COMP.CAR'
HEADING
""
FOOTING
"&RPT_START_TIME "


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Platinum Member
posted Hide Post
Hi Arif,

Here's a little code snippet that you can use that works. See if you can use it instead.

  
-SET &NOW = HHMMSS(&NOW);
-SET &HH = EDIT(&NOW,'99');
-SET &HR = IF &HH GT 12 THEN &HH - 12 ELSE IF &HH EQ 0 THEN 12 ELSE &HH + 0;
-SET &M = IF &HH LT 12 THEN 'am' ELSE 'pm';
-SET &RUNTIME = &HR | EDIT(&NOW,'$$$:99 ') | &M;


The Variable of the am pm format is &RUNTIME.

Best Regards,

Jimmy Pang


DEV: WF 7.6.10
TEST: WF 7.6.10
PROD: WF 7.6.10
MRE: WF 7.6.4
OS/Platform: Windows
Dev Studio: WF 7.7
Output: HTML, EXCEL, PDF, GRAPH, LOTUS, CSV
 
Posts: 117 | Location: Toronto, Ontario, Canada | Registered: February 29, 2008Report This Post
Guru
posted Hide Post
quote:
Where?
What values do each of your variables show?

Please show us *your* debugging work!

 
[IMG:top]c:\ibipic[/IMG]



WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
Error Parsing Reprot Requrest
 >-<
-SET &TESTIME = &TOD;
 


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
Arif,

I don't have CAR set up so here is thw code using one of out files
  
-SET &ECHO=ALL;

-SET &TESTTIME = &TOD ;
-* USE THE NEXT LINE AT THE END OF YOUR PROCEDURE FOR TIME STAMPING
-SET &HOURX = EDIT(&TESTTIME,'99') ;
-SET &HOUR = IF &HOURX GT 12 THEN &HOURX - 12 ELSE &HOURX ;
-SET &HOUR = IF &HOUR  LT '10' THEN &HOUR ELSE &HOUR ;
-SET &MIN  = EDIT(&TESTTIME,'$$$99') ;
-SET &RPTTIME = IF &HOURX LT '12' THEN &HOUR ||':'|| &MIN | ' AM'
-                                 ELSE &HOUR ||':'|| &MIN | ' PM' ;
-SET &TIMECHK = EDIT(&RPTTIME,'$9') ;
-SET &RPTTIME = IF &TIMECHK EQ ':' THEN '0' || &RPTTIME ELSE &RPTTIME ;
-SET &RPT_START_TIME = HHMMSS(&TOD);


TABLE FILE CPS_REPORT
PRINT
    *
FOOTING
"&RPT_START_TIME "

WHERE READLIMIT EQ 25
ON TABLE SET PAGE-NUM OFF
END



report

ID_CPS CD_MTHD CD_LANG CD_WRKR_STAT CD_CPS_TYPE CD_RSPNS CD_PS_DSCR CD_ANMTY FL_PERP_ACS FL_POLICE FL_LIFE_THRT FL_INTERP FL_INVS FL_RTM_TIME FL_RTM_FCTR FL_ABS_NGLCT FL_AGNCY FL_SUF_SCRN FL_INAPR_REF FL_INSUF_INVS DT_INCD ID_CR TS_CR TS_CPS_RCVD TX_SBJCT_NM ID_UP TS_UP CD_RPTR_DSCR CD_RTM_DSGNTN CD_SPVR_STAT CD_COM_STAT DT_POLICE DT_ARCHV ID_PRSN_COM ID_PRSN_SPVR ID_PRSN_RPTR ID_INVS CD_ARCHV ID_CASE ID_BSNS ID_PRVD_ORG TS_CASE_LINK TS_CPS_ACPT TS_RPTR_LTR TX_RTM_CD TX_AFLTN TX_SBJCT_FRST TX_SBJCT_MDL_INTL ID_TKLR ID_TKLR_CMPLT CD_DCF_WRK_INV TX_SPRV_NRTV TX_WRKR_NRTV CD_SCRNIN CD_SCRNOUT FL_MNDREP FL_DIRNR FL_AFTER_HOURS DT_RFRD CD_CNTY FL_CIA ID_INTK_CNTY FL_CNFDTL FL_CRITICAL_INCIDENT TS_INTK_RECOMNDTN CD_INCIDENT_LCTN ID_PRSN_CHLD_LCTN TS_CPS_START FL_CASE_OPEN FL_DIR_NARR FL_SAME_ADDR FL_MARK
1000399 4 19 3 4 4 406 . N N N N Y N N N N N N N 1984/03/06 00:00:00 10002 2004/10/01 20:09:36 1984/03/07 12:15:00 MOWREY 10010 2007/08/14 19:14:26 . 4 1 . . . . 1003207 . 10033250 . 1000382 . . 1984/03/07 12:15:00 1984/03/07 12:15:00 . 1984/03/07 12:15:00 21.00 . . . . 1984/03/07 00:00:00 100.00 . 1984/03/07 12:15:00 N N N N


11.53.21 this is the time


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Guru
posted Hide Post
Okay when I run this as an ad HOC PRocedure it works but it doesnt with when I run it using dev studio. is it related to Dev studio?

  
-SET &TESTTIME = &TOD ;
-* USE THE NEXT LINE AT THE END OF YOUR PROCEDURE FOR TIME STAMPING
-SET &HOURX = EDIT(&TESTTIME,'99') ;
-SET &HOUR = IF &HOURX GT 12 THEN &HOURX - 12 ELSE &HOURX ;
-SET &HOUR = IF &HOUR  LT '10' THEN &HOUR ELSE &HOUR ;
-SET &MIN  = EDIT(&TESTTIME,'$$$99') ;
-SET &RPTTIME = IF &HOURX LT '12' THEN &HOUR ||':'|| &MIN | ' AM'
-                                 ELSE &HOUR ||':'|| &MIN | ' PM' ;
-SET &TIMECHK = EDIT(&RPTTIME,'$9') ;
-SET &RPTTIME = IF &TIMECHK EQ ':' THEN '0' || &RPTTIME ELSE &RPTTIME ;
-SET &RPT_START_TIME = HHMMSS(&TOD);

TABLE FILE CAR


PRINT
    *
	BY CAR
FOOTING
"&RPT_START_TIME "

WHERE READLIMIT EQ 25
ON TABLE SET PAGE-NUM OFF
END


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
I am using dev studio. Add a -SET &ECHO=ALL; to your code and then paste the results.


WF 7.6.11
Oracle
WebSphere
Windows NT-5.2 x86 32bit
 
Posts: 398 | Registered: February 04, 2008Report This Post
Guru
posted Hide Post
I am using -SET &ECHO = ALL but when I run an error message pops up

Error Parsing Report Request.


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
IBI suggested to download HF 6 for my devstudio 7610. I am downloading it not and Will post what i findout.


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Guru
posted Hide Post
All I really appriciate the help. I think it was problem with my developer studio. It works fine now.

Regards,


WebFOCUS 7.6.10
Windows
HTML
 
Posts: 294 | Registered: March 04, 2010Report This Post
Platinum Member
posted Hide Post
Arif,

I know you solved your issue but you might want to look at this. You can do the timestamp in one line.

-* get the current data and time and format into a string of formatted as "Prepared on 01/29/2007 10:33:12AM"
-* save the current datetime into variable &NOW
-SET &NOW = 'Prepared on ' | HCNVRT(HGETC(8,'HMDYYm'),'(HMDYYSA)',30,'A30');

Then just put the &NOW in your footer. I got the HCNVRT code from a generous person on this forum.


prod:7.6.9, win2k3 mre, caster, bid, devstudio 7.6.9
 
Posts: 242 | Location: Minneapolis | Registered: February 16, 2006Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] &TOD to AM PM

Copyright © 1996-2020 Information Builders