Focal Point
[CLOSED] passing variable from html to fex

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

April 07, 2009, 08:04 AM
shakila25
[CLOSED] passing variable from html to fex
How to pass a variable form html hidden to fex sql passthru


While using dynamic drop down on select of first dropdown the value of firstdown or variable should be assigned to the second dropdown using sql passthru

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


WebFOCUS 7.6.x
Windows
Output: Excel,PDF, HTML
April 07, 2009, 08:18 AM
GamP
Sorry, I do not quite understand what you are saying.

Any variable from the html page, including te selected value of a dropdown box, is available in the fex that is called as &-variable.

If this is not the answer to your question, please explain a bit more.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
April 07, 2009, 01:53 PM
Rao D
Shakila,

If I understood correctly that you are trying to create a dynamic dropdowns and filter the second dropdown values based on the selected value in the first dropdown. Here is one way that you could use to create the dynamic nature

TABLE FILE CAR
PRINT CAR
BY COUNTRY

ON TABLE HOLD AS HOLD1 FORMAT ALPHA
END
DEFINE FILE HOLD1
TST/A100 = '"' ||COUNTRY || '"';
OPTION2/A100='GROUP.options[GROUP.options.length] = new Option(' | '''' || CAR || '''' ||','|'''' || CAR || '''' || ');' ;
END
TABLE FILE HOLD1
SUM OPTION2 AS ''
BY COUNTRY NOPRINT
BY CAR NOPRINT
ON COUNTRY SUBHEAD
"if (s ==")"
"{"
"GROUP.options[0] = new Option('ALL','ALL');"
ON COUNTRY SUBFOOT
"}"
ON TABLE HOLD AS CARLIST FORMAT WP
END

the above code holds values with javascript. Now on your HTML side you can use the javascript script as below

function Loadgroup(s)
{
var GROUP = document.form1.GROUP;
GROUP.options.length = 1;
!IBI.FIL.CARLIST;
}



If you are using SQLPASS thru instead of TABLE FILE you can still pass the variables to it as GAMP mentioned

RAO

This message has been edited. Last edited by: Rao D,


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio

April 07, 2009, 01:57 PM
Rao D
and call the function in html code


SELECT name="COUNTRY" id="country"   style="FONT-SIZE: 8pt; font-family: tahoma; WIDTH: 80px "  OnChange="Loadgroup[this.options[this.selectedIndex].text)
;"

This message has been edited. Last edited by: Rao D,


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio

April 08, 2009, 03:16 AM
GamP
If you post code, whatever code, put it between the code and /code tags, to be found by clicking the '< / >' icon when you post a reaction.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
April 08, 2009, 03:24 AM
shakila25
Hi Rao,
can you please specify how to pass variable in where clause

Thanks in advance


WebFOCUS 7.6.x
Windows
Output: Excel,PDF, HTML
April 08, 2009, 08:28 AM
Rao D
GAMP, Thanks for the suggestion I tried using '< !-- -->' but didn't work next time I will go with quotes ''.

Shakila, There are many ways to do this if you are getting multiple values from listbox and if you have your where clause is in FOCUS request then here is one way
'WHERE COUNTRY EQ &COUNTRY.(OR(FIND COUNTRY IN CAR)).COUNTRY.;'

The above code will be generated when you are using GUI to add a filter

if your where clause is in SQLPASS then this is one way

-*to replace "OR" with "," and to truncate spaces
'-TYPE COUNTRY -- &COUNTRY
-SET &COUNTRY = STRREP(&COUNTRY.LENGTH,&COUNTRY,4,' OR ',1,',',&COUNTRY.LENGTH,'A&COUNTRY.LENGTH') ;
-SET &COUNTRY = TRUNCATE(&COUNTRY) ;
-SET &CNTRY = '(' |&COUNTRY |')' ;
-SET &CNTRY = TRUNCATE(&CNTRY);
-TYPE CNTRY -- &CNTRY
-SET &COMPARE = TRUNCATE(&COUNTRY);
-SET &COMPARE = CTRAN (&COMPARE.LENGTH,&COMPARE,39,32,'A&COMPARE.LENGTH');
-SET &COMPARE = STRIP(&COMPARE.LENGTH,&COMPARE,' ','A&COMPARE.LENGTH') ;
-SET &COMPARE = TRUNCATE(&COMPARE);
-TYPE COMPARE -- &COMPARE;

-SET &SQLCNTRY = IF '&COMPARE.EVAL' EQ 'FOC_NONE' THEN ' ' ELSE 'AND COUNTRY IN ' | &CNTRY ;

-TYPE SQLCNTRY -- &SQLCNTRY ; '

Here you need to place this "&SQLCNTRY" variable in your SQL query

the input string for variable &COUNTRY will look like " 'ENGLAND' OR 'FRANCE' OR 'ITALY' "
and the output string for variable &SQLCNTRY will look like
" AND COUNTRY IN ('ENGLAND','FRANCE','ITALY') "

There are plenty of talented people on this forum who might suggest you in better way than me.

Rao.


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio

April 08, 2009, 08:40 AM
Tony A
Rao,

You can also edit previous posts by clicking on the relevant icon immediatley below the post in question. It would be good to go back and edit your posts so that we don't keep getting javascript errors.

You also didn't get the point from GamP, he suggested using [code ] and [/code] either side of your code (without the space).
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 
April 08, 2009, 09:18 AM
Rao D
Got IT!
Will follow! Smiler

Thanks TonyA and GamP


Rao.


WebFOCUS - ver8201
[ReportingServers: Windows 64bit;
Client: tomcat and IIS on windows 2012
AppStudio