Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Finding Passed Variable's Format
Go
New
Search
Notify
Tools
Reply
  
[CLOSED] Finding Passed Variable's Format
 Login/Join
 
Member
posted
I am passing a date formatted (MDYY) variable from an HTML page to a report. How can I test the report to see the format of the variable being passed? For simplicity sake I am using this code:

-DEFAULTH &DT = _FOC_NULL;
-SET &DT = IF &DT NE _FOC_NULL THEN &DT ELSE CLAIMS.FROM_DT;

TABLE FILE CLAIMS
PRINT
-* This NOPRINT is only here for the report to show properly. No calculatiosn are being done on it.
CLAIMS.FROM_DT NOPRINT
COMPUTE TM/MDYY = &DT;
END

It works if I just run it, but if I used the FROM_DT field in a combobox on the HTML page, and pass it to the report as &DT (via a Run Button) it doesn't work. I can't for the life of me figure out why it would work one way and not the other depending on where the variable is set.

This message has been edited. Last edited by: FP Mod Chuck,


John Coleman
WEBFocus 8.1.05
Windows 7
 
Posts: 15 | Location: Rensselaer, NY | Registered: May 20, 2016Reply With QuoteReport This Post
Virtuoso
posted Hide Post
What is &DT format passed by your HTML ? Are you using the Calendar control from HTML canvas, if so, which format have you selected ?

What is the defined format of CLAIMS.FROM_DT ?

It's possible that FROM_DT format is not a valid date format to reformat using /MDYY

Does FROM_DT is a date format in your file ?


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
quote:
CLAIMS.FROM_DT ?

The defined format of Claims.FROM_DT is MDYY

I am not using a calendar control. I am passing it from a combobox filled in dynamically by that field in the Master so &DT being passed should be the MDYY that the field is in the master, no?


John Coleman
WEBFocus 8.1.05
Windows 7
 
Posts: 15 | Location: Rensselaer, NY | Registered: May 20, 2016Reply With QuoteReport This Post
Expert
posted Hide Post
In the properties of your combobox, make sure it is sent as a quoted value.

It is possible that the value being sent is an alphanumeric representation of your date (variables do not have a real format) such as 08/19/2019, which will not pass the compute that you have.

If you make your page send it as a quoted value, '08/19/2019', it should be dealt with correctly.

You could test this (or use the code!) like this -

-SET &DT = IF &DT NE _FOC_NULL THEN '''' || &DT || '''' ELSE DATE;


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5601 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Virtuoso
posted Hide Post
quote:
Originally posted by John Coleman:
quote:
CLAIMS.FROM_DT ?

The defined format of Claims.FROM_DT is MDYY

I am not using a calendar control. I am passing it from a combobox filled in dynamically by that field in the Master so &DT being passed should be the MDYY that the field is in the master, no?


Is it the USAGE or the ACTUAL that is MDYY ?

And once passed from a parameter, in a sense, it all become either a text or a number depending if it includes characters or not

If you add this at the top of your fex that receive the parameter, what do you see ?

-TYPE Received Dt : &DT
-EXIT


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Member
posted Hide Post
MartinY - When I run the -TYPE it get back

Received Dt : 01/01/2014

That leads me to assume it Alphanumeric, since it has "/" in it. That doesn't explain how if I just set it to the field via the IF...THEN... statement, it works.

I really want to see what the format is coming from the HTML, can I use the ?FF on something being passed into the report?

I'm trying to understand the conversion I am missing, so forgive me if I seem obstinate.

This message has been edited. Last edited by: John Coleman,


John Coleman
WEBFocus 8.1.05
Windows 7
 
Posts: 15 | Location: Rensselaer, NY | Registered: May 20, 2016Reply With QuoteReport This Post
Virtuoso
posted Hide Post
The date display depend on your configuration under Reporting Server / Workspace / LOCALE / LOCALE (Language, Numbers, Currency, Dates) /
- DATE_ORDER
- DATE_SEPARATOR

-DEFAULTH &DT = 08/01/2019;

DEFINE FILE CAR
TM/MDYY  = &DT.QUOTEDSTRING;
TM2/A10  = &DT.QUOTEDSTRING;
END
TABLE FILE CAR
PRINT TM
      TM2
BY COUNTRY
END 

As per above sample, with the configuration that I have, TM is displayed as 2019-08-01 and since it's a text field TM2 is displayed as 08/01/2019

This is an invalid command : -SET &DT = IF &DT NE _FOC_NULL THEN &DT ELSE CLAIMS.FROM_DT;
You cannot set a variable to a file field value but you can set a variable to a file field for display such as below

-DEFAULTH &DT = 08/01/2019
-*-DEFAULTH &DT = _FOC_NULL

-SET &FLD = IF &DT NE _FOC_NULL THEN CAR ELSE _FOC_NULL;

DEFINE FILE CAR
TM/MDYY  = &DT.QUOTEDSTRING;
TM2/A10  = &DT.QUOTEDSTRING;
END
TABLE FILE CAR
PRINT TM
      TM2
BY COUNTRY
BY &FLD
END 


Why is this "I really want to see what the format is coming from the HTML" so important ?


WF versions : Prod 8.2.0.1M gen 240, Dev 8.2.04 gen 48, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
 
Posts: 2159 | Location: Montreal Area, Qc, CA | Registered: September 25, 2013Reply With QuoteReport This Post
Expert
posted Hide Post
quote:
This is an invalid command : -SET &DT = IF &DT NE _FOC_NULL THEN &DT ELSE CLAIMS.FROM_DT;

Not completely invalid - It works because of loose syntax rule or maybe by design?

If you really want to apply strict syntax, it could be made "syntax pure"(?!?!) by adding quotes around the assignment of the field. Add that to my suggestion above and this should do the trick -

-SET &DT = IF &DT NE _FOC_NULL THEN '''' || &DT || '''' ELSE 'CLAIMS.FROM_DT';


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5601 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [CLOSED] Finding Passed Variable's Format

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.