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     [SOLVED]How to supply null values for the checkbox control

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[SOLVED]How to supply null values for the checkbox control
 Login/Join
 
Guru
posted
Hi

I have a scenario where I need to pass the dates, other paramter values from Htmlpage1 to report1 and from report1, again it will drilling down to the detail report named report2. Remember, when passing to report2, it has to hold the paramter values from Htmlpage1 and report1. I do see quite a few posts similar to this and come up with the below code.

Actually, I got stuck up passing the null values when checkbox is not checked.

Htmlpage1 developed using Composer

report1
TABLE FILE CAR
PRINT COUNTRY CAR  
COMPUTE REC_COUNT/I5 = REC_COUNT + 1; NOPRINT
COMPUTE AREC_COUNT/A5 = EDIT(REC_COUNT); NOPRINT
COMPUTE CTRYFLD/A100 = '<input type="checkbox" name=CAR' | AREC_COUNT |' value="' | CAR | COUNTRY | '">';
BY COUNTRY NOPRINT
ON TABLE HOLD AS CAR_HOLD FORMAT HTMTABLE
END

-HTMLFORM BEGIN
<HTML>
<BODY>
<FORM name="wform" action='/ibi_apps/WFServlet' method="get">
<INPUT type="hidden" name="IBFS1_action" value="RUNFEX"/>
<INPUT type="hidden" name="IBFS_path" value="/WFC/Repository/WSX/testrifaz.fex"/>
!IBI.FIL.CAR_HOLD;
<input type=hidden name=howmany value=&LINES>
<INPUT type="submit" value="Run Report" target="_blank">
</FORM>
</BODY>
-HTMLFORM END
-EXIT
  


report2
 
testrifaz.fex
=============
-TYPE &CAR00001
-TYPE &CAR00002
:
:
-TYPE &CAR00010
-TYPE &howmany

  


How to tell &CAR000xx to pass value as ' ' when the checkbox is not checked.?

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


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Expert
posted Hide Post
HTML checkbox names and values do not get passed if they are not checked, so you have a couple of options.
  • -DEFAULTH all variables - this will be difficult as you are using &howmany to have a variable number.
  • Do away with the automatic submission of the HTML form and grow your own URL from the DOM.

I would be inclined to add an ID attributes to the form object to make it easier to obtain the form action attribute to begin the build of your URL.
Every other input can stay with just the name attribute. You can pull these into an array and append them to the URL depending upon whether they are hidden, checked checkboxes or unchecked checkboxes.

This is a quick piece of code which will give you an idea.
TABLE FILE CAR
PRINT COUNTRY CAR  
COMPUTE REC_COUNT/I5 = REC_COUNT + 1; NOPRINT
COMPUTE AREC_COUNT/A5 = EDIT(REC_COUNT); NOPRINT
COMPUTE CTRYFLD/A100 = '<input type="checkbox" name=CAR' | AREC_COUNT |' value="' | CAR | COUNTRY | '" />';
BY COUNTRY NOPRINT
ON TABLE HOLD AS CAR_HOLD FORMAT HTMTABLE
END

-HTMLFORM BEGIN
<html>
<head>
<script>
function build_url() {
  var objForm = document.getElementById("wform");
  var WF_URL  = objForm.action + "?";
  var arrInputs = document.getElementsByTagName("input");
  for (x=0; x<arrInputs.length; x++) {
    if (arrInputs[x].type === "checkbox" && arrInputs[x].checked) {
      WF_URL += "&" + arrInputs[x].name + "=" + arrInputs[x].value;
    } else {
      if (arrInputs[x].type === "checkbox") {
        WF_URL += "&" + arrInputs[x].name;
      } else {
        WF_URL += "&" + arrInputs[x].name + "=" + arrInputs[x].value;
      }
    }
  }
  window.open(WF_URL, "_blank" , "width=750,scrollbars=yes,resizable=yes, top=230, left=180, height=600"); 
}
</script>
</head>
<body>
<form id="wform" name="wform" action='/ibi_apps/WFServlet' method="get">
<input type="hidden" name="IBFS1_action" value="RUNFEX" />
<input type="hidden" name="IBFS_path" value="/WFC/Repository/WSX/testrifaz.fex" />
!IBI.FIL.CAR_HOLD;
<input type="hidden" name="howmany" value=!IBI.AMP.LINES;>
<input type="button" onclick="build_url();" value="Run Report" target="blank">
</form>
</body>
</html>
-HTMLFORM END


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5694 | Location: United Kingdom | Registered: April 08, 2004Report This Post
Guru
posted Hide Post
I was coming home on a car, saw the email someone responds to my query and shows up your name, I was pretty confident, going to see the solution. Focal point should have a Like button.
I will try out in real-time tomorrow and post here.

Thanks Tony Music


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Guru
posted Hide Post
It works with a little tweaks.


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Virtuoso
posted Hide Post
I'm not sure why you generate checkboxes with multiple names?

If you all give them the same name (say "CAR"), you get an amper-variable containing an array of the values that were checked, which is often what you need.

You can loop over the array using something like:
-DEFAULT &CAR0 = 1;
-TYPE Car 1: &CAR
-REPEAT :NEXTCAR FOR &C FROM 2 TO &CAR0;
-TYPE Car &C|: &CAR.&C
-:NEXTCAR


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
 COMPUTE CTRYFLD/A100 = '<input type="checkbox" name=CAR
' | AREC_COUNT |'
 value="' | CAR | COUNTRY | '" />';


I tried with simple CAR as a variable name but when building the URL to call another fex, it simply forms as &CAR.

May be, I am not able to follow up your suggestion. If you don't mind, can you please edit my complete code and post back.


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report This Post
Virtuoso
posted Hide Post
quote:
Originally posted by Rifaz:
I tried with simple CAR as a variable name but when building the URL to call another fex, it simply forms as &CAR.


It does show multiple checkboxes all named "CAR", right?
Then after it's been posted to the followup fex, the values are in an array.

Just printing &CAR fools you into thinking it's only a single value, as it only prints the first value in the array. In reality it's a list.
In that list, &CAR0 is the length of the list (say 'n') and &CAR1 to &CARn are the n values in the array. Hence the -REPEAT loop in my example. In this case, 'n' is the number of checked checkboxes (so <= 10).

There are a few things to take into account that you're probably going to run into:

  • If your array contains a single value, then &CAR1 does not exist and you have to print &CAR instead. That's why in my example I begin the -REPEAT loop at index 2 instead of 1.
  • If you create a drilldown to a further level of reports, CAR=&CAR.QUOTEDSTRING again only adds the first car value to the drilldown, not the array. That's an annoying limitation that I haven't been able to get around without using more -REPEAT loops (the number of those can add up this way!)

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


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 :
 
Posts: 1669 | Location: Enschede, Netherlands | Registered: August 12, 2010Report This Post
Guru
posted Hide Post
quote:
It does show multiple checkboxes all named "CAR", right?

Yes, &CAR fools me, I knew about this but wouldn't strike in my mind after seeing the URL alert call.

I was writing a logic to append the zeros depends on the inputs but it is no more required, my lines of code now is reduced to 3 from 12 and it is much simpler to understand.
Thanks Wep5622 for looking into it even after posting as SOLVED.

I no need to worry about &CAR0 as I'm going to use &howmany to execute the loops anyhow. Actually, I'm writing the datas into the file and using the WHERE IN FILE in my final report.


-Rifaz

WebFOCUS 7.7.x and 8.x
 
Posts: 406 | Location: India | Registered: June 13, 2013Report 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     [SOLVED]How to supply null values for the checkbox control

Copyright © 1996-2020 Information Builders