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.
I have a new report that I'm writing and the data is being sent from a vendor. The user can select what they see in column1, column2, etc. when they run the report. Column1 could be a date in the format of mm/yyyy or a date in the format of mm/dd or it could be an amount. The dates come over in the format of mm/dd/yyyy so I have to convert them to the proper format to display (either mm/yyyy or mm/dd). The amount field is also sent with 8 decimal places and the user only wants to see 2. I will be told what the user selected for each field so I know what format I would need for that column.
I figured I would define the field in the master as A20 for both usage and actual so that all values could be read easily but that complicates all 3 formats ... dates are much easier to work with when they are read in as smart date format. I've tried other formats for usage like D14.2BC to cover majority of scenarios and left actual as A20 but then I get nothing to display when the dates appear ... so I'm thinking I'm stuck with A20 for both. Is this true?
I'm trying to now set up defines in my code to cover all scenarios (there are 8 fields so code has to be duplicated for each field). My define section is getting rather huge, so I'm now questioning if I'm doing this the smartest way possible. I'm creating 3 fields (one numeric and one for each date type) for each field that comes in and determining which kind of field it needs to be. Is there a better way to do this? I can define the master however I want to define it.
Thanks.This message has been edited. Last edited by: Pam Kratt,
I had not thought to use a variable for formatting, but it's a great idea if I can get it to work. When I was just playing with it, It wasn't liking the format because the field is defined on the master as A20 (so this would be equiv to your IN_FIELD in your example) so it said RESULT OF EXPRESSION IS NOT COMPATIBLE WITH THE FORMAT OF FIELD on INFIELD/YYMD (I tried a variety of date formats including you 'YY/M/D' and none worked). RSquared - Do I need to define my master as something different than A20?
Pam In the ACTUAL/USAGE of an MFD, you can change the USAGE to something useful when the ACTUAL is an A20. e.g. USAGE=YYMD, ACTUAL=A20,.
However in a DEFINE this characteristic is not available.
Whilst others may have a better solution, I would approach this by using a dynamic mfd during the report using EDAPUT (there are examples of this in the forum). This way the fields can be formatted as the report requires. This would also require DEFINES to be added into the mfd where you need to change an ACTUAL of YYMD to MYY or MD.
Alan. WF 7.705/8.007
Posts: 1451 | Location: Portugal | Registered: February 07, 2007
Pam, Here's an example of varaible formatting that works ok. Maybe of use......
TABLE FILE CAR
SUM RCOST DCOST
COMPUTE
MYFMT/A8 = IF RCOST GT 10000 THEN 'P15.2CL' ELSE 'P15.2CS'; NOPRINT
COMPUTE
TESTER/P15.2C = RCOST-DCOST;
TESTER/MYFMT AS 'VARFORMAT'
BY COUNTRY
BY CAR
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT HTML
END
-EXIT
Have a play !!
_______________________ *** WebFOCUS 8.1.05M ***
Posts: 196 | Location: London, UK | Registered: December 06, 2005
I agree with Alan, use EDAPUT to create your MFD within your fex. I use this quite a bit and it works GREAT. Below is the 'How To' Alan gave me years ago:
For those that are interested EDAPUT info:
The EDAPUT command syntax is:
EX -LINES {n} EDAPUT {File Type},{App/}{File Name},{Create Type},{Create Location}
n : Number of lines including EDAPUT Line File Type : Type of File (e.g. MASTER, FOCEXEC, ACCESS, etc See Below) App/ : Optionally Specify the APP directory File Name : Name of the File without the extension Create Type : Type of Create (CV=Create Variable, C=Create Fixed) Create Location : File Location (FILE=Write to Current Location, MEM=Write to Memory only (V5.2 or later))
Watch out for... • In V5.2 or later, if a file exists in the EDAPATH, it WILL be replaced, unless you use the MEM option. • IBI say that this is internal code and is therefore NOT Supported
Known File Types, there may be more... Version 5.1.4 Version 7.1.6 & 7.6.4 FILETYPE Extension FILETYPE Extension ACCESS acx ACCESS acx ADR adr ACCESSU acx AFM afm ADR adr BMP bmp AFM afm BST bst BMP bmp DATA dat BST bst DDS DDS DATA dat EDASYNA acx DDS DDS EDASYNM mas DTD dtd EDASYNR fex EDASYNA acx EPS eps EDASYNM mas EXCEL xls EDASYNR fex FMU fmu EPS eps FOCCOMP fcm ETG etg FOCDEF def ETL etl FOCEXEC fex EXCEL xls FOCFTMAP fmp FMU fmu FOCPSB psb FOCCOMP fcm FOCSQL acx FOCCOMPW fcm FOCSTYLE sty FOCDEF def FOCTEMP ftm FOCEXEC fex FOCUS foc FOCEXECU fex GIF gif FOCFTMAP fmp HLI hli FOCPSB psb HOLDACC acx FOCSQL acx HOLDMAST mas GIF gif HTML htm FOCSTYLE sty MASTER mas FOCSTYLU sty MASTERU mas FOCTEMP ftm MNTPAINT mpt FOCUS foc OMI omi GIFU gif PDF pdf HLI hli PFA pfa HOLDACC acx PFB pfb HOLDMAST mas PS ps HTML htm TABS txt HTMLU htm TDL tdl JPG jpg TTEDIT tte LSN lsn TXT txt MAINTAIN mnt WINFORMS wfm MAINTAIU mnt XHT xht MASTER mas XML xml MASTERU mas XSL xsl MNTPAINT mpt OMI omi PDF pdf PFA pfa PFB pfb PS ps SVG svg TABS txt TDL tdl TRF trf TTEDIT tte TXT txt WINFORMS wfm WINFORMU wfm WSDL wsd XHT xht XML xml XSD xsd XSL xsl
One approach might be to read the input file with the A20 as you have it and then separate the different input patterns (Amount, Date, etc.) into separate columns in a hold file. You could then do whatever transformations are necessary on the individual columns rather than a fantastically complicated one on a single column.
For example:
DEFINE FILE XYZ ITS_A_DATE/A20=IF INPUT_FIELD CONTAINS '/' THEN INPUT_FIELD ELSE ''; ITS_AN_AMOUNT/A20=IF INPUT FIELD NOT CONTAINS '/' THEN INPUT_FIELD ELSE ''; END [/CODE] If course you could do you transformations within the same two lines if you wished.This message has been edited. Last edited by: George Patton,
Thank you to all that responded. I had this pretty much working based on the responses, only to find out the vendor is sending a file format where the fields are fixed (column1 will always be an amount, column 2 will always be a date, etc.) and that what I was currently being given was not accurate. Thanks for all the help!