Focal Point
[CLOSED] what is the use of LET NOPRINT

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/5167032495

November 24, 2010, 08:49 AM
rp
[CLOSED] what is the use of LET NOPRINT
Hi All,

what is the use of LET in 'LET NOPRINT '.

thanks
RP

This message has been edited. Last edited by: Kerry,


webfocus 7.6.9 windows XP Excel
November 24, 2010, 09:26 AM
<JG>
Without a right hand component it means nothing.

What's to the right of the =

Is it

LET NOPRINT = ;
LET NOPRINT = 'Happy Christmas'

Where is it coded

in a focexec or edasprof.prf or another profile file?
November 24, 2010, 10:40 AM
GamP
LET is a way of creating substitutes.
For instance, if I specify LET RP=TABLE, I could code RP FILE CAR PRINT *
It means that RP gets substituted by TABLE at runtime.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 25, 2010, 02:43 AM
Dave
Eeker

That is useful, we use &qout;param for these kind of constructions...

Why isn't LET documented?
(it's not to be found in the 'help')

Legacy?


_____________________
WF: 8.0.0.9 > going 8.2.0.5
November 25, 2010, 03:47 AM
GamP
Yes, it is a legacy thing. Although I know that it exists, I never use it.
It used to work fine with Focus, but I tried it once in WebFocus and it failed for some odd reason. So I decided to let LET be and never used it again.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
November 26, 2010, 02:57 AM
Dave
Like the Beatles would say..

Let LET be.


_____________________
WF: 8.0.0.9 > going 8.2.0.5
November 29, 2010, 12:01 PM
Kerry
Hi RP,

Suggestion from our technicals:

As mentioned, the use of LET will create a substitution. In the case of:

LET NOPRINT=;

a substitution is generated so that when FOCUS sees NOPRINT, it will be replaced by blank. This is an interesting way to prevent people from using NOPRINT in their code. Try this:

LET NOPRINT=;
TABLE FILE CAR
PRINT COUNTRY NOPRINT
END

Notice that COUNTRY will still show up in the output.

Cheers,

Kerry


Kerry Zhan
Focal Point Moderator
Information Builders, Inc.
November 30, 2010, 03:44 AM
<JG>
Old, no documentation number and notice the word legacy in the URL

WebFOCUS Defining a Word Substitution

This message has been edited. Last edited by: <JG>,
December 01, 2010, 08:57 AM
jgelona
While LET is cool, I never had much use for it except for OS commands. For example, say one wants to delete a file. In Windows one might do:
-DOS DEL path/filename


while in UNIX or Linux it would be
-UNIX rm path/filename


One could put the following in the edasprof
LET OSDEL=-UNIX rm


and use the following in the code:
OSDEL path/filename


So if the code might run on a Windows and a Linux reporting server, doing something like this keeps one from having to change code when moving between environments. All one has to do is change OSDEL in the edasprof of the Reporting Server.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
December 01, 2010, 11:20 AM
Wep5622
I'd say it's a fairly powerful debugging tool. Say you have a graph that doesn't display what it should be displaying. You put
LET GRAPH=TABLE;
in your fex and you can see what values it's using.

I haven't tried, but you could for example conditionally create a GRAPH or a TABLE.
Like so:
-GOTO TYPE_&OUTPUTFORMAT
-TYPE_TABLE
LET OUTPUT = TABLE;
LET FMT = HTML;
-GOTO TYPE_END

-TYPE_GRAPH
LET OUTPUT = GRAPH;
LET FMT = PNG;
-TYPE_END

OUTPUT FILE CAR
PRINT WIDTH
BY LENGTH
ON TABLE PCHOLD FORMAT FMT
END


Of course you need to be very careful not to accidentally overwrite a core Focus command, that would give some interesting results for sure!

You can do the same using ampersand-variables, but you'll frequently find you need to eval them.


WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :
December 02, 2010, 10:37 AM
Brian Suter
As a software engineer I find the use of LET to be a great trick. As a manager of many software engineers I would bar the use of LET in any production software.

Think of the poor guy trying to maintain a 500 line fex who sees GRAPH ... but getting TABLE?!?! All because much further up in the fex there is a -INCLUDE and the included file did some trickery that CHANGES the language.

If you use &VARs the subsequent readers KNOW there is a substitution.

(getting off my sandbox).


Brian Suter
VP WebFOCUS Product Development
December 03, 2010, 04:08 AM
Wep5622
Certainly true, it's as powerful a tool as it is dangerous.

I also just found out that you apparently can't use it for number formatting :/
-* File let.fex
TABLE FILE CAR
PRINT WEIGHT/P12.2
BY CAR
END

LET WGT = P12.2

TABLE FILE CAR
PRINT WEIGHT/WGT
BY CAR
END

-*0 ERROR AT OR NEAR LINE     10  IN PROCEDURE let     FOCEXEC *
-*(FOC035) ERROR IN THE FORMAT OF THE COMPUTED FIELD DEFINITION: WEIGHT/WGT
-*BYPASSING TO END OF COMMAND
-*(FOC009) INCOMPLETE REQUEST STATEMENT



WebFOCUS 8.1.03, Windows 7-64/2008-64, IBM DB2/400, Oracle 11g & RDB, MS SQL-Server 2005, SAP, PostgreSQL 11, Output: HTML, PDF, Excel 2010
: Member of User Group Benelux :