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 an amper variable -- &DATEwrMtrDYY -- which returns the current date in the following way 'September 18, 2018'. I want to use &DATEwrMtrDYY as a by sort in my report. I did the following:
BY &DATEwrMtrDYY
in my report and it returns an error saying A WORD IS NOT RECOGNIZED: September.
I have tried using a define and setting that to equal &DATEwrMtrDYY and that also doesn't work.
How would I go about using &DATEwrMtrDYY as a by field?This message has been edited. Last edited by: Anguel,
When you use the define, are you turning it into an Alphnumeric? Seems to work fine for me:
DEFINE FILE CAR
DATE_AMPER/A70V='&DATEwrMtrDYY';
END
TABLE FILE CAR
BY DATE_AMPER
BY COUNTRY
BY CAR
BY MODEL
ON TABLE PCHOLD FORMAT HTML
ON TABLE SET STYLE *
ENDSTYLE
END
-RUN
It sounds like you're in the very beginning of learning the programming language parts of FOCUS.
I highly recommend you download the Command Language Reference for your version.
First let me suggest a simple answer to your question.
DEFINE FILE CAR TODAYSDATE/wrMtrDYY=&MDYY; END TABLE FILE CAR PRINT COUNTRY TODAYSDATE END
But more importantly, let me help you understand a short debugging technique we all use a lot.
In your code, right at the top, add this line:
-SET &ECHO=ON;
Then run your code with the BY &DATEwrMtrDYY again. Notice what it's actually trying to run...
The word after the BY has to be a FOCUS fieldname. You're putting a literal in there (like 'september') which is not a fieldname, so FOCUS dies.
You'll end up using the &ECHO bit over and over. I wouldn't leave that in there when you go to promote your code for the world to see, but while you're developing, it'll help you see what FOCUS is actually trying to execute.
The settings for &ECHO are ON, ALL or OFF. The default is OFF. When you run it with ON - you'll get the same set of code that is being sent to the WebFOCUS Reporting server to be executed. The & variables will be replaced with their corresponding values.
The other main way we use &ECHO is to use ALL instead of ON. The difference here is that ALL will also show you the Dialog Manager commands along with the FOCUS commands.
In case it wasn't confusing enough in the beginning, I'll explain.
There are 2 kinds of commands you'll see in your code. Dialog Manager commands have a '-' in the first or 2nd column. Like
-SET &MYNAMEIS='Toby'; -TYPE the name is &MYNAMEIS
The other type of code does not have the - in front. This code is destined to actually run in FOCUS's brain on the reporting server. Typically this is going to some kind of data retrieval to make reports or mash data together. Examples of this are TABLE FILE, DEFINE FILE, JOIN, MATCH FILE etc..
At your stage of development skill, it's important you start understanding the difference between dialog manager commands and FOCUS code.
Playing with &ECHO will help you see what's happening.
I don't know if anybody even teaches internals anymore, but on a high level, you use Dialog Manager and it's & variables to help you build your FOCUS code. For example you might use Dialog Manager to branch around certain FOCUS TABLE FILE commands that might not be needed. Just realize that & variables get turned into their corresponding values (like September) BEFORE the FOCUS language interpreter runs them.
Timing of the parts of the language:
Dialog Manager code happens right now - as soon as WebFOCUS sees the - commands, they are evaluated immediately. But - not true for plain old FOCUS code. That code is sort of 'stacked up' and gets sent in one batch to be executed.
You can PM me and we can try to go over this more. You're at a stage where you're just about over the hump and you'll be much better once you understand the way WebFOCUS code is parsed and used.