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:
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,
Windows, All Outputs
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
WF Version 8105
Thank you. That did fix it.
I didn't put the single quotes around the variable. And that was causing the problem.
Windows, All Outputs
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
TABLE FILE CAR
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:
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
-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.
Hang in there.
Toby Mills, CISSP
|Powered by Social Strata|