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     Replicating a Crystal 8.5 report in FOCUS 7.1.

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Replicating a Crystal 8.5 report in FOCUS 7.1.
 Login/Join
 
Silver Member
posted
I am replicating a Crystal 8.5 report in FOCUS 7.1. The time field I am trying to include in calculations is stored as a Number field in Crystal (a Packed in FOCUS).
(I.E., 11:25 is 1173972349 in output).

In reviewing the Crystal field calculation the following Crystal function was used to display the time as 11:25 :

Mid( UnixTimeToString1 ({casemas.SH_TIMESCHED}), InStr( UnixTimeToString1 ({casemas.SH_TIMESCHED}), " ") + 1, 8)

Is there a comparable function in FOCUS so that I may convert this number to a time value?


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Virtuoso
posted Hide Post
I don't think there is a function as such, but you can work it out manually.

The Unix date is number of seconds from a base of 00:00:00 31/12/1969. One day is approx 86400 secs.
So take number MOD 86400. The result will be the number of seconds into a day. Take the reult and divide by sixty. Take the integer of the final result/60 to get the hour and then final result MOD 60 to get the minutes. Something like this:
  
TIME/D12=1173972349;
R1/I8= IMOD(TIME,86400,R1);
HOUR/I2 = (R1/60)/60;
MIN/I2 = IMOD((R1/60),60,MIN);
ALPHA_TIME/A5 = EDIT(HOUR) | ':' | EDIT(MIN);


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Silver Member
posted Hide Post
Thanks, I will try this and respond if it works.


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Silver Member
posted Hide Post
Alan instead of getting 11:45 I am getting 15:45 can you help. Don't know where to tweak to make it be 11:45.


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Virtuoso
posted Hide Post
Nailzz

This is UTC time, so you have to convert UTC to your local time, at the moment this means you have to subtract 14400, 4 hours * 60 * 60. But of course this varies for daylight saving. So you have to pick up your UTC offset from the server. I would use a bit of JS, but not sure if you can in your circumstance.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Silver Member
posted Hide Post
Thanks, didn't even think about that. I will try this.


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Virtuoso
posted Hide Post
Alan is right, you must account for time zone differences. However, the number of hours to subtract changes throughout the year due to DST. I wrote a DEFINE FUNCTION that you can use to determine if a date is during DST. If it is then subtract 4 hours else subtract 5 hours.

Input to the function is a smart date. Output is an A1 with a 'Y' or an 'N'.

I hope this is useful.

-***************************************
-* The following function is used to
-* determine whether or not a certain
-* date is during day light savings time
-* or not.
-* RETURN FORMAT: A1 (Y or N)
-***************************************
DEFINE FUNCTION DSTIMEYN (CURNT_DT/YYMD)
CURNT_YR/YY=CURNT_DT;
CURNT_MT/M =CURNT_DT;
CURNT_DOW/W=CURNT_DT;
CURNT_DOM/D=CURNT_DT;
CURNT_I_DOW/I1=CURNT_DOW;
CURNT_I_DOM/I2=CURNT_DOM;
-***************************************
MTH_ID/A4 =
IF (CURNT_YR LE '2006') THEN
DECODE CURNT_MT( 4 '0604' 10 '0610' ELSE '????') ELSE
DECODE CURNT_MT( 3 '0703' 11 '0711' ELSE '????');
-***************************************
-* The following are used for 2006 and prior.
-***************************************
APR_ID/A1 =
IF (CURNT_I_DOM GE 8) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ CURNT_I_DOM) THEN 'N' ELSE
IF (CURNT_I_DOW GT CURNT_I_DOM) THEN 'N' ELSE 'Y';
OCT_ID/A1 =
IF (CURNT_I_DOM LE 24) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'N' ELSE
IF (CURNT_I_DOW EQ (CURNT_I_DOM - 24)) THEN 'Y' ELSE
IF (CURNT_I_DOW GT (CURNT_I_DOM - 24)) THEN 'Y' ELSE 'N';
-***************************************
-* The following are used for 2007 and beyond.
-***************************************
MAR_ID/A1 =
IF (CURNT_I_DOM LE 7) THEN 'N' ELSE
IF (CURNT_I_DOM GE 15) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'Y' ELSE
IF (CURNT_I_DOW EQ (CURNT_I_DOM - 7)) THEN 'N' ELSE
IF (CURNT_I_DOW GT (CURNT_I_DOM - 7)) THEN 'N' ELSE 'Y';
NOV_ID/A1 =
IF (CURNT_I_DOM GE 8) THEN 'N' ELSE
IF (CURNT_I_DOW EQ 7) THEN 'N' ELSE
IF (CURNT_I_DOW EQ CURNT_I_DOM) THEN 'Y' ELSE
IF (CURNT_I_DOW GT CURNT_I_DOM) THEN 'Y' ELSE 'N';
-***************************************
DSTIMEYN/A1=
IF (CURNT_YR LE '2006') AND (MTH_ID EQ '????') THEN
DECODE CURNT_MT(1 N 2 N 3 N 4 ? 5 Y 6 Y 7 Y 8 Y 9 Y 10 ? 11 N 12 N) ELSE
IF (CURNT_YR GT '2006') AND (MTH_ID EQ '????') THEN
DECODE CURNT_MT(1 N 2 N 3 ? 4 Y 5 Y 6 Y 7 Y 8 Y 9 Y 10 Y 11 ? 12 N) ELSE
IF (MTH_ID EQ '0604') THEN APR_ID ELSE
IF (MTH_ID EQ '0610') THEN OCT_ID ELSE
IF (MTH_ID EQ '0703') THEN MAR_ID ELSE
IF (MTH_ID EQ '0711') THEN NOV_ID ELSE '@';
END
TABLE FILE EMPDATA
PRINT SEG.PIN
COMPUTE IN_DST/A1=DSTIMEYN(HIREDATE);
ON TABLE SET STYLE *
DEFMACRO=NDST, BACKCOLOR=GREEN, COLOR=WHITE, STYLE=BOLD,
WHEN=IN_DST EQ 'N',$
DEFMACRO=YDST, BACKCOLOR=PURPLE, COLOR=WHITE, STYLE=BOLD,
WHEN=IN_DST EQ 'Y',$
TYPE=DATA, COLUMN=HIREDATE, MACRO=YDST,$
TYPE=DATA, COLUMN=HIREDATE, MACRO=NDST,$
TYPE=DATA, COLUMN=IN_DST , MACRO=YDST,$
TYPE=DATA, COLUMN=IN_DST , MACRO=NDST,$
ENDSTYLE
END


Thanks!

Mickey

FOCUS/WebFOCUS 1990 - 2011
 
Posts: 995 | Location: Gaithersburg, MD, USA | Registered: May 07, 2003Report This Post
Silver Member
posted Hide Post
Thanks guys. What Alan sent worked.


WebFOCUS 7.1.3 on Win 2000
 
Posts: 45 | Location: North Carolina | Registered: February 17, 2005Report This Post
Virtuoso
posted Hide Post
Just as a follow on, in case anyone is interested, I found the UTC code I use:
  
.
.
-HTMLFORM BEGIN
<html>
<head>
<script language="JavaScript1.2" type="text/javascript" runat=server>
function currentUTC(){
var d, s;
d = new Date();
s = d.getTimezoneOffset()*60;
return(s);
}
</script>
<script language="JavaScript1.2" type="text/javascript">
function runFunc(){
var t = currentUTC();
document.getElementById("myVar1").value=t;
document.getElementById("runForm").submit();
}
</script>
</head>
<body>

!IBI.FIL.HOLD;

<form method="post" name="runForm" id="runForm" action="WFServlet">
<input type="hidden" name="IBIF_focexec" id="IBIF_focexec" value="myFex">
<input type="hidden" name="myVar1" id="myVar1" value="">
<input type="button" name="myBut" id="myBut" value="submit" onclick="runFunc();">
</form>
</body>
</html>
-HTMLFORM END


or use javascript on a drill down, instead of the button.

This gives the offset in seconds.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report 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     Replicating a Crystal 8.5 report in FOCUS 7.1.

Copyright © 1996-2020 Information Builders