Focal Point Banner
Community Center Education Summit Technical Support User Groups
Let's Get Social!

Facebook Twitter LinkedIn YouTube
Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Passing Values onto HTML docs using !IBI.AMP
Go
New
Search
Notify
Tools
Reply
  
[SOLVED] Passing Values onto HTML docs using !IBI.AMP
 Login/Join
 
Member
posted
I am trying to get the value of a field passed from my hold file to display on the HTML document. I know it can be done if the value is a constant by using !IBI.AMP.FOO, where FOO is the defined Amper Variable. When I try to set FOO from a value in my table it will not pass.

Example:

TABLE FILE FOO
COMPUTE FOO_PCT/D3.1% = SUM.FOO.FOO_ONE / SUM.FOO.FOO_TWO * 100;
ON TABLE HOLD AS FOO_HOLD FORMAT BINARY
END
-RUN

If I set an Amper Variable named &TEST to the value of FOO_PCT ( -SET &TEST = FOO.FOO_PCTWink and pass it to my HTML using !IBI.AMP.FOO_PCT, the text that is displayed is "FOO.FOO_PCT", but I am looking to have it display whatever value FOO_PCT calculates out to, say 2.2%.

Is this possible? I am completely lost and trying to see if I am banging my head against a wall for nothing.

John

EDIT - I have an example of what I am trying to do using the wf_lite data set if that would be any less confusing, but it is erroring out so I don't think it would be helpful.

This message has been edited. Last edited by: FP Mod Chuck,


John Coleman
WEBFocus 8.1.05
Windows 7
 
Posts: 12 | Location: Rensselaer, NY | Registered: May 20, 2016Reply With QuoteReport This Post
Guru
posted Hide Post
Yes please. Post the wf_lite code to see exactly what you are trying to do.

However, in looking at your post, the variable you are setting is &TEST so in the html, it should be: !IBI.AMP.TEST;


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 369 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Virtuoso
posted Hide Post
HOLD will not maintain the formatting masks, only the raw numbers. But to populate an &VAR with the data from this request, you could use -READFILE. Once the numbers are in &variables you can pass them to anything you want. Something like this:

  
-DEFAULTH &FOO_PCT=;
-DEFAULTH &RETAIL_COST=;
-DEFAULTH &DEALER_COST=;
SET HOLDLIST=PRINTONLY
SET ASNAME=ON
TABLE FILE CAR
SUM RETAIL DEALER
COMPUTE FOO_PCT/D12.2 = (RETAIL-DEALER)*100/RETAIL;
ON TABLE HOLD
END
-RUN
-READFILE HOLD
-TYPE &RETAIL_COST &DEALER_COST &FOO_PCT


WebFOCUS 8204, Unix, Windows
 
Posts: 1617 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Member
posted Hide Post
I did find that one of the issues I am running into. I found some documentation about using a -READ statement after the hold table to populate the variable. The issue I am finding now is that the formats have to match and they cannot have a '.' in them. So the code becomes:

TABLE FILE FOO
COMPUTE FOO_PCT/I5 = SUM.FOO.FOO_ONE / SUM.FOO.FOO_TWO * 100; AS 'FOO_PCT'
ON TABLE HOLD AS FOO_HOLD FORMAT BINARY
END
-RUN

-READ FOO_HOLD &FOO_PCT.I5
-TYPE &FOO_PCT

This -READ passes the value into &FOO_PCT but the formats must match and not have a decimal (At least to my research knowledge thus far). So the code above works and gives me an Integer, say 30, but the actual value should be in D3.1%L, say 30.9%. If the format is switched to D3.1%L the code breaks and it requests a value for &FOO_PCT.


So thanks for the help but back to the drawing board, if anyone has any other ideas, I'm open.

@Hallway - I will try to put that up as soon as I work n this a few minutes more.

@BabakNYC - That code was not giving me a value, but I will keep poking at it.


John Coleman
WEBFocus 8.1.05
Windows 7
 
Posts: 12 | Location: Rensselaer, NY | Registered: May 20, 2016Reply With QuoteReport This Post
Virtuoso
posted Hide Post
Do you have an error or just no data? If you have car file in your path, you should get data from the -READFILE.


WebFOCUS 8204, Unix, Windows
 
Posts: 1617 | Location: New York City | Registered: December 30, 2015Reply With QuoteReport This Post
Expert
posted Hide Post
You might also want to check out DMPRECISION setting if you are going to use decimals in your variables.


T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.06 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
 
Posts: 5575 | Location: United Kingdom | Registered: April 08, 2004Reply With QuoteReport This Post
Member
posted Hide Post
quote:
Originally posted by Hallway:
Yes please. Post the wf_lite code to see exactly what you are trying to do.

However, in looking at your post, the variable you are setting is &TEST so in the html, it should be: !IBI.AMP.TEST;


Here is the code for WF_LITE

-* File: IBFS:/Dev/WFC/Repository/Retail_Samples/~jcoleman/Report1.fex Created by WebFOCUS AppStudio
SET HOLDLIST = PRINTONLY

TABLE FILE WF_RETAIL_LITE
SUM
COMPUTE Sold_per_MSRP/I5 = WF_RETAIL_LITE.WF_RETAIL_SALES.MSRP_US / WF_RETAIL_LITE.WF_RETAIL_SALES.QUANTITY_SOLD; AS 'MSRP_QS'

ON TABLE HOLD AS TEST FORMAT ALPHA


END
-RUN

-READ TEST &MSRP_QS.I5
-TYPE &MSRP_QS


John Coleman
WEBFocus 8.1.05
Windows 7
 
Posts: 12 | Location: Rensselaer, NY | Registered: May 20, 2016Reply With QuoteReport This Post
Guru
posted Hide Post
Try this code
  
-DEFAULTH &MSRP_QS = 0;
-SET DMPRECISION = 2;

SET HOLDLIST = PRINTONLY
SET ASNAMES = ON
SET CENT-ZERO = ON

TABLE FILE WF_RETAIL_LITE
SUM
COMPUTE Sold_per_MSRP/D12.2 = WF_RETAIL_LITE.WF_RETAIL_SALES.MSRP_US / WF_RETAIL_LITE.WF_RETAIL_SALES.QUANTITY_SOLD; AS 'MSRP_QS'
ON TABLE HOLD AS TEST FORMAT BINARY
END
-RUN

-READFILE TEST
-TYPE &|MSRP_QS = &MSRP_QS &MSRP_QS.TYPE

-HTMLFORM BEGIN NOEVAL
<style>
* {
    font-family: 'Trebuchet MS','Lucida Sans Unicode','Lucida Grande','Lucida Sans',Arial,sans-serif;
}
</style>
<h1>The value for &amp;MSRP_QS is: !IBI.AMP.MSRP_QS; </h1>
-HTMLFORM END

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


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 369 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
Guru
posted Hide Post
I edited the code above to include the variable in an HTMLFORM


Hallway
WF(Prod):8202M
WF(Test):8202M
OS/Platform:Win 10
Outputs:All
 
Posts: 369 | Location: Salt Lake City, UT, USA | Registered: November 18, 2015Reply With QuoteReport This Post
  Powered by Social Strata  
 

Focal Point    Focal Point Forums  Hop To Forum Categories  WebFOCUS/FOCUS Forum on Focal Point     [SOLVED] Passing Values onto HTML docs using !IBI.AMP

Copyright © 1996-2018 Information Builders, leaders in enterprise business intelligence.