Focal Point Banner


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.


Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Show "ALL" in Dropdown box in focexec

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Show "ALL" in Dropdown box in focexec
 Login/Join
 
Silver Member
posted
Hi everybody,

I'm using Sudio Developer version 7.1.

I'm trying to filter my data based on some conditions. One of my fields(Organization) is displayed in a dropdown box that is populated from a masterfile(SPROBAB). In my Focexec report, I'm doing some conditional branching and I need to display 'All' in my dropdown box.
I cannot make it show 'All' and the logic requires that and when I add that to the dropdown box in the launch page, the logic is ignored and that condition is not recognized.
Is there any way of adding "All" to the dropdown box before getting to the launch page?

Any help would be appreciated,

Here is my code:

-SET &ECHO=ON;
-SET &NAMELEN='A'||&NAME.LENGTH;
-SET &NAME1=UPCASE(&NAME.LENGTH, &NAME, '&NAMELEN');

DEFINE FILE SPROBAB
L_NAME/A40V=UPCASE(40, LASTNAME, 'A40V');
F_NAME/A30V=UPCASE(30,FIRSTNAME, 'A30V');
END
-IF &NAME EQ ' ' AND &Org NOT EQ 'ALL' THEN GOTO FILTERORG
-ELSE IF &NAME NOT EQ ' ' AND &Org EQ 'ALL' THEN GOTO GETNAME
-ELSE IF &NAME NOT EQ ' ' AND &Org NOT EQ 'ALL' THEN GOTO FILTERALL
-ELSE IF &NAME EQ ' ' AND &Org EQ 'ALL' GOTO GETALL;
-*-RUN


-******************FILTER ORG*******************************
-FILTERORG
TABLE FILE SPROBAB
PRINT
FIRSTNAME AS 'FIRST NAME'
LASTNAME AS 'LAST NAME'
BUSINESSPHONENUMBER AS 'BUSINESS PHONE NUMBER'
EMAIL
ORGANIZATION
WHERE ORGANIZATION EQ '&Org.(FIND ORGANIZATION IN SPROBAB).&Org.';
END
-RUN
-EXIT
-******************************NO FILTERING, GET EVERYTHING*************************
-GETALL
TABLE FILE SPROBAB
PRINT
FIRSTNAME AS 'FIRST NAME'
LASTNAME AS 'LAST NAME'
BUSINESSPHONENUMBER AS 'BUSINESS PHONE NUMBER'
EMAIL
ORGANIZATION
END
-RUN
-*****************FILTER NAME********************************
-GETNAME
TABLE FILE SPROBAB

-*-TYPE Name Is not blank;
PRINT
FIRSTNAME AS 'FIRST NAME'
LASTNAME AS 'LAST NAME'
BUSINESSPHONENUMBER AS 'BUSINESS PHONE NUMBER'
EMAIL
ORGANIZATION
WHERE L_NAME LIKE '&NAME1.%' OR F_NAME LIKE '&NAME1.%';
END
-RUN

-***************FILTER NAME AND ORGANIZATION****************************
-FILTERALL
TABLE FILE SPROBAB

-*-TYPE Name and org are not blank;
PRINT
FIRSTNAME AS 'FIRST NAME'
LASTNAME AS 'LAST NAME'
BUSINESSPHONENUMBER AS 'BUSINESS PHONE NUMBER'
EMAIL
ORGANIZATION
WHERE L_NAME LIKE '&NAME1.%' OR F_NAME LIKE '&NAME1.%';
WHERE ORGANIZATION EQ '&Org.(FIND ORGANIZATION IN SPROBAB).org.';
END
-RUN
ON TABLE SET PAGE-NUM OFF
ON TABLE NOTOTAL
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET HTMLCSS ON
ON TABLE SET STYLE *
UNITS=IN,
PAGESIZE='SCREEN',
LEFTMARGIN=0.000000,
RIGHTMARGIN=0.000000,
TOPMARGIN=0.000000,
BOTTOMMARGIN=0.000000,
SQUEEZE=ON,
ORIENTATION=PORTRAIT,
$
TYPE=REPORT,
GRID=OFF,
FONT='ARIAL',
SIZE=9,
COLOR='BLACK',
BACKCOLOR='NONE',
STYLE=NORMAL,
RIGHTGAP=0.125000,
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
JUSTIFY=LEFT,
$
TYPE=DATA,
FONT='ARIAL',
SIZE=9,
BACKCOLOR=( 'WHITE' 'SILVER' ),
TOPGAP=0.013889,
BOTTOMGAP=0.027778,
JUSTIFY=CENTER,
$
TYPE=DATA,
COLUMN=N1,
JUSTIFY=LEFT,
$
TYPE=DATA,
COLUMN=N2,
JUSTIFY=LEFT,
$
TYPE=DATA,
COLUMN=N4,
JUSTIFY=LEFT,
$
TYPE=DATA,
COLUMN=N5,
JUSTIFY=LEFT,
$
TYPE=TITLE,
FONT='ARIAL',
SIZE=9,
BACKCOLOR=RGB(102 102 153),
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=TABHEADING,
SIZE=12,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=TABFOOTING,
SIZE=12,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=HEADING,
SIZE=10,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=FOOTING,
SIZE=12,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=SUBHEAD,
SIZE=10,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=SUBFOOT,
SIZE=10,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=SUBTOTAL,
BACKCOLOR=RGB(210 210 210),
JUSTIFY=CENTER,
$
TYPE=ACROSSVALUE,
SIZE=9,
JUSTIFY=CENTER,
$
TYPE=ACROSSTITLE,
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=GRANDTOTAL,
BACKCOLOR=RGB(210 210 210),
STYLE=BOLD,
JUSTIFY=CENTER,
$
TYPE=REPORT,
COLUMN=N1,
SQUEEZE=1.305556,
JUSTIFY=CENTER,
$
TYPE=REPORT,
COLUMN=N2,
SQUEEZE=1.430556,
JUSTIFY=CENTER,
$
TYPE=REPORT,
COLUMN=N4,
SQUEEZE=2.375000,
JUSTIFY=CENTER,
$
TYPE=REPORT,
COLUMN=N5,
SQUEEZE=2.750000,
$
TYPE=REPORT,
COLUMN=N3,
SQUEEZE=2.180556,
$
ENDSTYLE
END
-IF &RECORDS GT 0 GOTO THEEND;

-HTMLFORM BEGIN

No Records Found!



-HTMLFORM END

-THEEND
 
Posts: 35 | Location: Tallahassee,Florida | Registered: March 16, 2007Report This Post
<Tim Howard_ABCBS>
posted
You may try looking at the FOC_NONE function built into WebFocus that would allow you to create only one query instead of having to branch to multiples.

Here's how I've used it. In your launch page (the html page), check the 'Add "ALL" option' on the Parameters tab after choosing Dynamic values for the Dropdown box. By default, when 'ALL' is selected by the user, the variable is passed in with the value of 'FOC_NONE' instead of the value selected. So your focexec should simply look like the following:

-DEFAULT &CAR = 'DATSUN';

TABLE FILE CAR
PRINT CAR
MODEL
COUNTRY
WHERE CAR EQ '&CAR';
END


Hope this makes sense and is what you are looking for, I'd be glad to explain further if needed.

Tim H.
 
Report This Post
Virtuoso
posted Hide Post
There are a couple of minor points here, I may not get them all in one go.

The WHERE for ORGANIZATION should be:

WHERE ORGANIZATION EQ &Org.(OR(FIND ORGANIZATION IN SPROBAB)).Org.';

to automatically get an all (actually 'No Selection' which is the same), and take the & off the last .Org., and remove the single quotes.

The No Selection option will give a value of FOC_NONE in &Org, so compare &Org to 'FOC_NONE' not 'ALL' in your branching logic.

Beware of FOC_NONE though as it has evil powers. If a WHERE clause comes across FOC_NONE, the WHERE clause is ignored by WF. Not so bad for a single WHERE, but could (does) cause issues in compound WHERE clauses. In your case this mighht be used to advantage to reduce your code, but I haven't got that far.

Have a try and see if things improve.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
There are a couple different ways to do this.

Easiest, there is a checkbox when you create the parameter in DevStudio for Add "ALL" option.

Another way, is to check the dynamic checkbox and then specify that you will use a procedure. There is still the check box for Add "ALL" option.

The method I usually use, (because I don't use the HTML painter much and which I prefer because it gives me flexibility), is to use a fex to produce the values that will be in the dropdown. Example:

SET HOLDLIST = PRINTONLY
DEFINE FILE WREDFLAG
CODE_DESC/A49=RED_FLG_CD||' - '|RED_FLG_DESC;
LISTTEXT/A100='';
END
TABLE FILE WREDFLAG
SUM LISTTEXT
BY RED_FLG_CD NOPRINT
BY RED_FLG_DESC NOPRINT
ON TABLE SAVE AS RDFLGLST FORMAT ALPHA
END

Then in the -HTMLFORM I have the

SELECT name ="REDFLG" style=" FONT-STYLE: normal;" >
<
OPTION value=ALL>ALL
!IBI.FIL.RDFLGLST;


Then I code around the 'ALL' value that is passed.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
One other tip - It's probably a matter of preference, but rather than recoding your whole procedure each time, just write the procedure once and use Dialogue manager to branch within the WHERE section. Not a big deal for small procedures like yours, but if the procedure were large and complex, yoo would have to change it several places andy time you made changes, and you would have a lot of unnecessary code that has to be stored, parsed, and run every time.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Silver Member
posted Hide Post
Thank you guys for your responses.

I modified my code to the following:
-SET &ECHO=ON;
-SET &NAMELEN='A'||&NAME.LENGTH;
-SET &NAME1=UPCASE(&NAME.LENGTH, &NAME, '&NAMELEN');
DEFINE FILE SPROBAB
L_NAME/A40V=UPCASE(40, LASTNAME, 'A40V');
F_NAME/A30V=UPCASE(30,FIRSTNAME, 'A30V');
END

-DEFAULT &NAME='FOC_NONE';
-DEFAULT &Org='FOC_NONE';


-*-FILTERALL
TABLE FILE SPROBAB

-*-TYPE Name and org are not blank;
PRINT

FIRSTNAME AS 'FIRST NAME'
LASTNAME AS 'LAST NAME'
BUSINESSPHONENUMBER AS 'BUSINESS PHONE NUMBER'
EMAIL
ORGANIZATION
WHERE L_NAME LIKE '&NAME1.%' OR F_NAME LIKE '&NAME1.%';
WHERE ORGANIZATION EQ &Org.(OR(FIND ORGANIZATION IN SPROBAB)).Org.;

But still when I don't make any selection, it ignores my default and gives me this message:

DEFINE FILE SPROBAB
L_NAME/A40V=UPCASE(40, LASTNAME, 'A40V');
F_NAME/A30V=UPCASE(30,FIRSTNAME, 'A30V');
END
TABLE FILE SPROBAB
PRINT
FIRSTNAME AS 'FIRST NAME'
LASTNAME AS 'LAST NAME'
BUSINESSPHONENUMBER AS 'BUSINESS PHONE NUMBER'
EMAIL
ORGANIZATION
WHERE L_NAME LIKE ' %' OR F_NAME LIKE ' %';
WHERE ORGANIZATION EQ ;
ON TABLE SET PAGE-NUM OFF
0 ERROR AT OR NEAR LINE 24 IN PROCEDURE ADHOCRQ FOCEXEC *
(FOC260) AN OPERATION IS MISSING AN ARGUMENT
(FOC258) FIELDNAME OR COMPUTATIONAL ELEMENT NOT RECOGNIZED: ON
BYPASSING TO END OF COMMAND
(FOC009) INCOMPLETE REQUEST STATEMENT


Any suggestions?


WebFocus 7.1
Developer Studio
 
Posts: 35 | Location: Tallahassee,Florida | Registered: March 16, 2007Report This Post
Virtuoso
posted Hide Post
I would still suggest AGAINST using FOC_NONE - you're asking for trouble. But if you must, you probably want something more like the following:
 
-DEFAULT &NAME='FOC_NONE'
-DEFAULT &Org='FOC_NONE'
-SET &ECHO=ON;
-SET &NAMELEN='A'||&NAME.LENGTH;
-SET &NAME1=UPCASE(&NAME.LENGTH, &NAME, '&NAMELEN');
DEFINE FILE SPROBAB
L_NAME/A40V=UPCASE(40, LASTNAME, 'A40V');
F_NAME/A30V=UPCASE(30,FIRSTNAME, 'A30V');
END
TABLE FILE SPROBAB
PRINT
FIRSTNAME AS 'FIRST NAME'
LASTNAME AS 'LAST NAME'
BUSINESSPHONENUMBER AS 'BUSINESS PHONE NUMBER'
EMAIL
ORGANIZATION
-IF &NAME EQ 'FOC_NONE' THEN GOTO SKIPSELNAME;
WHERE L_NAME LIKE '&NAME1.%' OR F_NAME LIKE '&NAME1.%';
-SKIPSELNAME
-IF &ORG EQ 'FOC_NONE' THEN GOTO SKIPSELORG;
WHERE ORGANIZATION EQ &Org.(OR(FIND ORGANIZATION IN SPROBAB)).Org.;
-SKIPSELORG
 


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Virtuoso
posted Hide Post
Well i just did a quick conversion to the EMPLOYEE file:

-SET &ECHO=ALL;
-SET &NAMELEN='A'||&NAME.LENGTH;
-SET &NAME1=UPCASE(&NAME.LENGTH, &NAME, '&NAMELEN');

DEFINE FILE EMPLOYEE
L_NAME/A40V=UPCASE(40, LAST_NAME, 'A40V');
F_NAME/A30V=UPCASE(30,FIRST_NAME, 'A30V');
END

-DEFAULT &NAME='FOC_NONE';
-DEFAULT &Org='FOC_NONE';

-*-FILTERALL
TABLE FILE EMPLOYEE

-*-TYPE Name and org are not blank;
PRINT

FIRST_NAME AS 'FIRST NAME'
LAST_NAME AS 'LAST NAME'
DEPARTMENT
WHERE L_NAME LIKE '&NAME1.%' OR F_NAME LIKE '&NAME1.%';
WHERE DEPARTMENT EQ &Org.(OR(FIND DEPARTMENT IN EMPLOYEE)).Org.;
END

and this worked straight from the box.
I might be tempted to add:
-SET &NAME1=IF &NAME1 EQ ' ' THEN FOC_NONE ELSE &NAME1;
and have
-DEFAULT &NAME=' ';
to stop FOC_NONE appearing as a value to the users.
The output appeared, with no selection, as:
 -SET &NAMELEN='A'||01;
 -SET &NAME1=UPCASE(01,  , 'A01');
  DEFINE FILE EMPLOYEE
 L_NAME/A40V=UPCASE(40, LAST_NAME, 'A40V');
 F_NAME/A30V=UPCASE(30,FIRST_NAME, 'A30V');
 END
 -DEFAULT &NAME=' ';
 -DEFAULT &Org='FOC_NONE';
 -SET &NAME1 = IF   EQ ' ' THEN FOC_NONE ELSE  ;
 -*-FILTERALL
 TABLE FILE EMPLOYEE
 -*-TYPE Name and org are not blank;
 PRINT
 FIRST_NAME AS 'FIRST NAME'
 LAST_NAME AS 'LAST NAME'
 DEPARTMENT
 WHERE L_NAME LIKE 'FOC_NONE%' OR F_NAME LIKE 'FOC_NONE%';
 WHERE DEPARTMENT EQ FOC_NONE;
 END
 0 NUMBER OF RECORDS IN TABLE=       12  LINES=     12

So the approach you have seems fine, wonder what else is getting in the way. Have you got DM logic above this that might remove the FOC_NONE from the &variables?

Can't agree with Darin, for once, that FOC_NONE is asking for trouble. It is a valid approach and will cause no issues if you understand how it works.

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Virtuoso
posted Hide Post
Right you are, Alan. It IS a valid approach and I have (and do) use it occasionally. The problem, as you mention, is understanding how it works. It affects more than what you would initially think - especially to those new to the realm. But then learning and using the stuff is how you get past being a novice.
I guess, I've just developed a preference for other methods that don't come back to bite me as often.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
 
Posts: 2298 | Location: Salt Lake City, Utah | Registered: February 02, 2007Report This Post
Silver Member
posted Hide Post
It worked! Thank you so much everybody!!
I'm having another problem though. My boss has decided to use a launch page. For the name field I am using a textbox. I am using Js to default the value of the textbox to "FOC_NONE" if the user leaves it blank and then I'm changing it's color to white so the user doesn't see "FOC_NONE" as the value, but the problem is that the first time the report is ran and the submit button is clicked nothing happens, but the second time it works fine. Does anybody know why this is happening and does anybody have a better idea of how to hide the value of a textbox?
Here is my code in the launch page:

function button1_OnClick(ctrl)
{
// TODO: add validation code here
if (combobox1.value.length==0)
	{
	
	combobox1.value="FOC_NONE"		combobox1.style.color="#FFFFFF"
	
	
	}
else


	OnExecute(ctrl)
}

<INPUT language=java_script id=button1 style="Z-INDEX: 4; LEFT: 50px; WIDTH: 120px; POSITION: absolute; TOP: 130px; HEIGHT: 30px" onclick=button1_OnClick[this) tabIndex=5 type=button value=Run name=button1 requests_list="1">

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


WebFocus 7.1
Developer Studio
 
Posts: 35 | Location: Tallahassee,Florida | Registered: March 16, 2007Report This Post
<Tim Howard_ABCBS>
posted
You could always just check the textbox value in the focexec code for spaces and set the variable equal to FOC_NONE in Dialog Manager:

-SET &SAMPVAR = IF &SAMPVAR EQ " " THEN FOC_NONE ELSE &SAMPVAR;


This way the value of the textbox is never set to FOC_NONE in the html and you will not have to worry about hiding it.

Hope this helps.

Tim H.
 
Report This Post
Silver Member
posted Hide Post
Thanks Tim,
I just noticed that Alan had anticipated the problem and a way of controlling it and I didn't notice it. I'm gonna try that!
thanks


WebFocus 7.1
Developer Studio
 
Posts: 35 | Location: Tallahassee,Florida | Registered: March 16, 2007Report This Post
Virtuoso
posted Hide Post
Basically I agree with Tim's approach, similar to my suggestion in my previous response.

However in your js you are referring to combobox1, which is not a textbox, are we seeing the right code?

Also there is a missing '{' after the else.

(Response overlap with Robab)


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
Silver Member
posted Hide Post
Alan,

The id by default was combobox1 and I didn't change it but the type is textbox. and the last "}" that you see closes the function, I'm not useing {} for else because it was just one line.


WebFocus 7.1
Developer Studio
 
Posts: 35 | Location: Tallahassee,Florida | Registered: March 16, 2007Report This Post
Virtuoso
posted Hide Post
Okay, fine. Just thought I'd mention it.

Without a lot more of your code I don't think I can help anymore, just try using an alert here and there to try and trace where the js is going.

Signing off for the week now, it's over 90 degrees here and I'm going for a beer.


Alan.
WF 7.705/8.007
 
Posts: 1451 | Location: Portugal | Registered: February 07, 2007Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     Show "ALL" in Dropdown box in focexec

Copyright © 1996-2020 Information Builders