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     Amper variables within a report

Read-Only Read-Only Topic
Go
Search
Notify
Tools
Amper variables within a report
 Login/Join
 
Gold member
posted
Ok... I'm working on a possible solution to get variables passed from a form into a table without having to loop through for each variable.

I'll try to display what I mean with the CAR TABLE.

1. I'm asking the user to give me new car names for each car if they have changed. So the first report is:

-***********************
DEFINE FILE CAR
NEWCAR/A100 = '<INPUT TYPE="TEXT" NAME="NEW' || CAR ||'" VALUE="' || CAR || '" SIZE="12" MAXLENGTH="20">';
END

TABLE FILE CAR
PRINT NEWCAR
BY CAR
IF CAR EQ 'JAGUAR' OR 'BMW'
ON TABLE HOLD FORMAT HTMTABLE
END

-HTMLFORM BEGIN
<FORN ACTION="/cgi-bin/ibi_cgi/webapi.dll" METHOD="get" TARGET="Info">
<INPUT TYPE="hidden" NAME="IBIF_ex" VALUE="changeNAME">

!IBI.FIL.TABLE1;

<INPUT TYPE="submit" VALUE="Modify">
</FORN>
-HTMLFORM END
-***********************
2. So in the report they would have a textfield that is prefilled with the Car Name but is editable if the car name should have changed.
The form would end up passing 2 variables: &NEWJAGUAR and &NEWBMW filled with whatever the user entered... say they left JAGUAR the same and change BMW to BEAMER

therefore in the second fex file... I could do -TYPE new bmw = &NEWBMW and it would give me the text field.

Now what I'm trying to do is have the amper variables automatically fill in the table. such that I would create the amper variables that exist and then I want them filled with the value in those variables.

DEFINE FILE CAR
NCAR/A20 = '&' || 'NEW' || CAR;
END

TABLE FILE CAR
PRINT NCAR
BY CAR
IF CAR EQ 'BMW' OR 'JAGUAR'
END

I want NCAR to show 'BEAMER' INSTEAD OF &NEWBMW... is there a way to create the Amper variable and have it display its value without having to loop through for each different CAR.

thanks,

Leo
 
Posts: 96 | Location: Winnipeg, Manitoba, Canada | Registered: January 22, 2004Report This Post
<WFUser>
posted
This will work but you may need an &var for each value.

DEFAULT &NEW=&NEW
-SET &NEWBMW='BEAMER';
-SET &NEWJAGUAR='JAGUAR';
DEFINE FILE CAR
NCAR/A50 = '!IBI.AMP.NEW' || CAR || ';';
END
TABLE FILE CAR
PRINT NCAR
BY CAR
IF CAR EQ 'BMW' OR 'JAGUAR'
ON TABLE HOLD AS TEST1 FORMAT HTML
END
-RUN
-HTMLFORM TEST1
 
Report This Post
Gold member
posted Hide Post
Yeah it works with format HTML on display.. but then I can't grab that value and use it to perform Modifies and what not.. I guess I didn't specify that I would then grab these new values and make changes to the database. I'm trying to grab this into a "ON TABLE HOLD AS HOLD1 FORMAT ALPHA"

thanks,

Leo
 
Posts: 96 | Location: Winnipeg, Manitoba, Canada | Registered: January 22, 2004Report This Post
<Pietro De Santis>
posted
You cannot do what you want. Dialog Manager variables have no relation to data in a hold file.
 
Report This Post
Gold member
posted Hide Post
It seems so close... guess that's why I figured I'd post it to see if it was possible... but I guess not.

Last time I had to do this.. I assigned all the amper variables numbers... starting at 1 and then looping and reading them 1 at time and inserting them in the table that way. Guess I'll end up doing the same.

thanks anyways!

Leo
 
Posts: 96 | Location: Winnipeg, Manitoba, Canada | Registered: January 22, 2004Report This Post
<Pietro De Santis>
posted
You could first create a temporary hold file with a Dialog Manager loop -WRITE statement and then join the hold file and the file you want to update. Within the DM loop you can use your numbered variables.
 
Report This Post
Expert
posted Hide Post
escape character for that ornery & is the pipe |.
so, eg. if you need to force a space in a header, you do this:
HEADING
"&|nbsp;My Header Text"
and...
if you need to pass an &VAR thru an Href, you just write that nice href as a character string and plop a pipe after the &.
I've done exactly what you're asking(if i understand you)
fex 1 creates the form, using -HTMLFORM BEGIN syntax, with an empty input box for whatever value;
the form calls fex2 which does the modify


http://grwf01/cgi-bin/ibi_cgi/webapi.dll?IBIF_ex=fexnum...&|CUSTTYPE=&CUSTTYPE
click here
method='get' >

Does this give you any ideas?

This message has been edited. Last edited by: <Mabel>,
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
<JG>
posted
A way to do it would be to use dynamically generated javascript to give you a single variable that can be used as a decode

Means running the first report twice to generate two htmltables



DEFINE FILE CAR
newval/A140 = '"&' || 'Q.EVAL' || CAR ||'&' || 'Q.EVAL, &' || 'Q.EVAL"+' ||
'document.FRED.' || 'NEW' || CAR || '.value' || '+ "&' || 'Q.EVAL," + ';
END

TABLE FILE CAR
PRINT newval
BY CAR NOPRINT
IF CAR EQ 'JAGUAR' OR 'BMW'
ON TABLE HOLD AS TABLE1 FORMAT ALPHA
END
DEFINE FILE CAR
NEWCAR/A140 = '';
END
TABLE FILE CAR
PRINT NEWCAR
BY CAR
IF CAR EQ 'JAGUAR' OR 'BMW'
ON TABLE HOLD AS TABLE2 FORMAT HTMTABLE
END
-HTMLFORM BEGIN

<script LANGUAGE="JavaScript">
function saveMe() {
NEWCARS = document.FRED.NEWCARS;

NEWCARS.value = (" " +
!IBI.FIL.TABLE1;
" ")
;
}






!IBI.FIL.TABLE2;


-HTMLFORM END
-*

Your second table request would then look like

-*
-SET &Q='''';
DEFINE FILE CAR
NCAR/A20 = DECODE CAR(&NEWCARS.EVAL 'DUMMY','DUMMY' ELSE '');
-*-INCLUDE DCLIST
END
TABLE FILE CAR
PRINT NCAR
BY CAR
IF CAR EQ 'BMW' OR 'JAGUAR'
END

This message has been edited. Last edited by: <Mabel>,
 
Report This Post
Expert
posted Hide Post
ah. jack's back! that's brilliant.
 
Posts: 3811 | Location: Manhattan | Registered: October 28, 2003Report This Post
Gold member
posted Hide Post
I was hoping there was a way to force an Evalution of the Amper variable after I produce the correct name of the amper variable in the table and that wasn't the case.

My solution ended up being reading them in a number fashion then linking to the previous data by the rank number.

the second report would just loop till there isn't anymore numbers to process.

And the first report instead of sending &NEWJAGUAR and &NEWBMW... would send &001NAME and &002NAME

-**************************
-SET &NUMBER = 001;
-SET &NUMNAME = &NUMBER | 'NAME';

-STARTTOP

-IF &.&NUMNAME.LENGTH LT '01' THEN GOTO DONE;

-SET &MODIFIED = 'Y';

MODIFY FILE TEMPCHG
FIXFORM RANK/3 X1 NEWNAME/20
MATCH RANK
ON MATCH INCLUDE
ON NOMATCH INCLUDE
DATA
&NUMBER &.&NUMNAME
END

-*
-* Check to see if we are going to loop through it again
-*
-NEXTNUM
-SET &NUMBER = &NUMBER + 1;
-SET &NUMBER = IF &NUMBER.LENGTH EQ '01' THEN ('00' | &NUMBER) ELSE
- IF &NUMBER.LENGTH EQ '02' THEN ('0' | &NUMBER) ELSE &NUMBER;

-SET &NUMNAME = &NUMBER | 'NAME';

-IF &.&NUMSIC.LENGTH GT '00' THEN GOTO STARTTOP;
-DONE
-**************************

And it does the trick nicely. I had done this for another problem and it worked fine... but I was curious to learn other ways that may be more elegant.

thanks,

Leo
 
Posts: 96 | Location: Winnipeg, Manitoba, Canada | Registered: January 22, 2004Report This Post
Gold member
posted Hide Post
Although I must admit... I like the Javascript solution! thanks JG

Leo
 
Posts: 96 | Location: Winnipeg, Manitoba, Canada | Registered: January 22, 2004Report 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     Amper variables within a report

Copyright © 1996-2020 Information Builders