Focal Point
[SOLVED]Hiding an Image in HTML output...

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

October 20, 2011, 02:57 PM
ERINP
[SOLVED]Hiding an Image in HTML output...
I have the following code:
     COMPUTE A_GREENBAR/A15 = FTOA(GREENBAR, '(D12)', A_GREENBAR); AS 'ALPHA Green' NOPRINT
     COMPUTE A_BLUEBAR/A15 = FTOA(BLUEBAR, '(D12)', A_BLUEBAR); AS 'ALPHA Blue' NOPRINT
     COMPUTE A_ORANGEBAR/A15 = FTOA(ORANGEBAR, '(D12)', A_ORANGEBAR); AS 'ALPHA Orange' NOPRINT
     COMPUTE A_PURPLEBAR/A15 = FTOA(PURPLEBAR, '(D12)', A_PURPLEBAR); AS 'ALPHA Purple' NOPRINT
     COMPUTE A_REDBAR/A15 = FTOA(REDBAR, '(D12)', A_REDBAR); AS 'ALPHA Red' NOPRINT

COMPUTE MYBAR/A750 =
'<TD WIDTH="104" ALIGN="LEFT" >' |
'<IMG RUNAT="SERVER" SRC="https://mySite/myFolder/images/gGreen.gif" ' |
' HEIGHT=13 WIDTH="' | A_GREENBAR | '">' |
'<IMG runat="server" SRC="https://mySite/myFolder/images/gBlue.gif" ' |
' HEIGHT=13 WIDTH="' | A_BLUEBAR | '">' |
'<IMG runat="server" SRC="https://mySite/myFolder/images/gOrange.gif" ' |
' HEIGHT=13 WIDTH="' | A_ORANGEBAR | '">' |
'<IMG runat="server" SRC="https://mySite/myFolder/images/gPurple.gif" ' |
' HEIGHT=13 WIDTH="' | A_PURPLEBAR | '">' |
'<IMG runat="server" SRC="https://mySite/myFolder/images/gRed.gif" ' |
' HEIGHT=13 WIDTH="' | A_REDBAR | '">' |
'</TD>'; AS ''  


If the value for A_GREENBAR or A_BLUEBAR or... is/are equal to 0 then I want to hide this image in the MYBAR using visible=false. I am trying to use the example in Tips and Techniques Graphtype... but I can not hide the colored bars when they are equal to 0.

Any Ideas??

ERINP

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


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
October 20, 2011, 03:03 PM
njsden
Sorry ... I don't think I get it ... which image do you want to hide exactly? under which conditions?



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 20, 2011, 03:10 PM
ERINP
njsden,
As an example if the FTOA(GREENBAR, '(D12)', A_GREENBAR); is EQ to 0 then in the MYBAR code I want to add visible="false" something like:
  
'<TD WIDTH="104" ALIGN="LEFT" >' |
'<IMG RUNAT="SERVER" SRC="https://mySite/myFolder/images/gGreen.gif" ' |
' HEIGHT=13 WIDTH="' | A_GREENBAR | '" visible="false">' |


actually I will probably create another compute and dynamically place true or false in as the value.

Does that make sense??

ERINP


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
October 20, 2011, 03:26 PM
Francis Mariani
quote:
visible="false"

Where did you get that from?

CSS Visibility is controlled by this syntax:

visibility:hidden;


Take a look at this documentation: CSS Display and Visibility


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
October 20, 2011, 03:55 PM
ERINP
Francis,
In Visual Studio 2005 I can hide the image using:
 <img runat="server" src= "https://mySite/myFolder/images/gGreen.gif" alt="" style="height:13px" visible="false"/> 

I am merely trying to do in webFOCUS what I typically do in Visual Studio.

I can attempt the CSS in my code but I was trying to avoid creating the class, referencing it, building it dynamically, and coding it...

ERINP


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
October 20, 2011, 04:25 PM
njsden
visible="false" is an ASP.NET attribute, not part of HTML. Under the covers, ASP.NET creates the CSS necessary to render those objects as specified.

You don't need to create a CSS class for that. Just use inline styling with what Francis recommended.

See:

'<TD WIDTH="104" ALIGN="LEFT" >' |
'<IMG RUNAT="SERVER" SRC="https://mySite/myFolder/images/gGreen.gif" ' |
' HEIGHT=13 WIDTH="' | A_GREENBAR | '" style="visibility:hidden;">' |


That runat="server" stuff is also not needed! It's only applicable to ASP.NET as well.



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 20, 2011, 04:31 PM
njsden
Now, what's the purpose of adding an image to the page if it's not going to be visible?

If you need to go through the trouble of determining visibility based on A_COLORBAR, you could instead determine if the whole IMG tag is needed based on the same.

As a bonus, the web page will render slightly faster!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 20, 2011, 04:32 PM
ERINP
njsden and Francis,
thank you for the insite and the help.
Using the Inline Styling did the trick now I just need to make the "style="visibility:hidden;" dynamic based on values within my report.

Thanks again,
ERINP


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
October 20, 2011, 04:36 PM
ERINP
quote:

Now, what's the purpose of adding an image to the page if it's not going to be visible?


Based on a sample in the tips and techniques I am using the colorbars to create a horizontal graph for eachrow of data within a report. I have 5 colors, some or all may be blank, based on there percentages I set the width of the image as a representation of the underlying data. which allows for a visualization of the data. Once I get it hooked up I will create a CAR example to better explain.


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
October 20, 2011, 04:43 PM
njsden
Something like this ...

COMPUTE A_GREENBAR/A100 = IF GREENBAR GT 0 THEN '<img src="https://mySite/myFolder/images/gGreen.gif" ' ||
                            'height="13" width="' || FTOA(GREENBAR, '(D12)') || '" />' ELSE ''; 
COMPUTE A_BLUEBAR/A100  = IF BLUEBAR GT 0 THEN '<img src="https://mySite/myFolder/images/gBlue.gif" ' ||
                            'height="13" width="' || FTOA(BLUEBAR, '(D12)') || '" />' ELSE ''; 
...
COMPUTE MYBAR/A750 =
'<td width="104" align="left" >' || A_GREENBAR || A_GREENBAR || ... || A_REDBAR || '</td>';




Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 20, 2011, 04:44 PM
njsden
Oh, I did not see your response before I posted the message above. Anyway, it does not really matter. Hopefully the visibility style will do what you need.

Cheers!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 21, 2011, 08:44 AM
ERINP
njsden,
Thats the type of logic I was looking for... I was wondering how I was going to wiggle thru the combinations and permutations for 5 colored bars... Thank You for shedding light on my clouded thinking. Idea

ERINP


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
October 21, 2011, 01:27 PM
njsden
You're welcome! You had most of it there anyway so your thinking was much clearer than you think Wink

If this is now working for you, would you mind editing your post and prefixing its title with [SOLVED]?

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



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.
October 21, 2011, 01:38 PM
ERINP
njsden,
I added the [solved] to the header of my original post. I am going to re-create what I was/am attempting to do with the CAR file cuz its sort of neat.

Thanks Again,
ERINP


WebFOCUS 7.6.9

Reporting client Windows 2003 Service pack 2 using IIS and TomCat 5.5
Reporting Server OS/400 V5R4M0
Outputs: HTML, Excel, PDF, CSV, and Flat Files
October 21, 2011, 01:46 PM
njsden
Great! Please do post your sample code once it's ready. As you said, it is a neat technique which either of us here may have a need for in future projects.

Thank you!



Prod/Dev: WF Server 8008/Win 2008 - WF Client 8008/Win 2008 - Dev. Studio: 8008/Windows 7 - DBMS: Oracle 11g Rel 2
Test: Dev. Studio 8008 /Windows 7 (Local) Output:HTML, EXL2K.