Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Hiding Controls through Scriptin
DEV SAHU
Hi All,<br />
<br />
we want to hide controls(images to be specific) based on the dataset.<br />
for example in the below image the check boxes in front of Mr. and Mrs.<br />
are images(as Birt does not provide default CheckBox Functionality)<br />
based on the data sale row["SALUTATION"]='Mr.' only image in front<br />
of Mr. should be shown and the Image in front of the Mrs. should be hidden.<br />
<br />
we tried googled alot.<br />
we tried the below code <br />
<strong class='bbc'>onFetch event of Dataset:</strong><br />
<br />
var SAL= this.getRowData().getExpressionValue("row["SALUTATION"]");<br />
<br />
reportContext.setPersistentGlobalVariable("SAL1", SAL);<br />
<br />
<br />
<strong class='bbc'>beforeRender of rptdesing :</strong><br />
<br />
var SAL2= reportContext.getPersistentGlobalVariable('SAL1');<br />
if(SAL2 == 'Mr.')<br />
{<br />
reportContext.getDesignHandle().getElementByID(65).visibilty= true;<br />
}<br />
else<br />
{<br />
reportContext.getDesignHandle().getElementByID(65).visibilty=false;<br />
}<br />
<br />
Kindly guide us how this could be achieved.
Find more posts tagged with
Comments
bricombs
Good Day
You can add both the images to your report and then use the visiblity property to set which one displays.
I created a small sample report. It shows one image if the office site is 3 or less and a different one if the office site is 4 or more. You should be able to do the same for Mr or Mrs.
DEV SAHU
<blockquote class='ipsBlockquote' data-author="'bricombs'" data-cid="115156" data-time="1363625700" data-date="18 March 2013 - 09:55 AM"><p>
Good Day<br />
You can add both the images to your report and then use the visiblity property to set which one displays.<br />
<br />
I created a small sample report. It shows one image if the office site is 3 or less and a different one if the office site is 4 or more. You should be able to do the same for Mr or Mrs.
bricombs
Good Day
If the table is bound to the dataset you don?t even need to include that field in the table to use it. For example take my sample and remove the column that shows the OfficeCode.
Please also note that you can add any logic you want to the Visibility Expression to control when an image is visible.
DEV SAHU
<blockquote class='ipsBlockquote' data-author="'bricombs'" data-cid="115200" data-time="1363712957" data-date="19 March 2013 - 10:09 AM"><p>
Good Day<br />
If the table is bound to the dataset you don?t even need to include that field in the table to use it. For example take my sample and remove the column that shows the OfficeCode. <br />
<br />
Please also note that you can add any logic you want to the Visibility Expression to control when an image is visible.<br /></p></blockquote>
<br />
<br />
Hi All,<br />
<br />
I am still facing the problem for assigning the any column data to any variable in javascript<br />
so that same can be assigned dynamically to other fields.<br />
I am trying to get the data in the variable and trying to fill letter by letter in the box like<br />
we fill the form.<br />
<br />
any help will be appreciated.<br />
Thanx in advance.
bricombs
Good Day
Your new question appears to be a different topic then your original question. However you can code your report so that a single letter will display in each cell. Two ways that come to mind are the following:
1. Create a table and bind it to your dataset. Then use the Dynamic Text Report Item to display only a single letter. For example if you create a 20 column by 2 row report you can do the following.
Create a globel vareable in the report initialize: GCounter = 0;
Then in the first Colunm of each detal row add code like the following:
GCounter = 0
row["ADDRESSLINE1"].substr(GCounter,1);
Then for all other columns in the row you will have the following code:
GCounter +=1;
row["ADDRESSLINE1"].substr(GCounter,1);
Of course you will want to add some logic to so you to check for the end of the string so you can display blanks if it ends before the last column.
2. If you want to do it all by code and use a grid with labels you could do the following:
Use a naming convention so you know where each label is in the grid. For example:
r1c1 r1c2 r1c3
r2c1 r2c2 r2c3
You can then create a loop in the Grid onPrepare that sets the value of each label. example code that does this for a 3x3 grid.
var rowcount = 1;
var columncount = 1;
do
{
columncount = 1; //reset the column count to one as we are on a new row.
do
{
var s = "r" + rowcount + "c" + columncount;
lbl =reportContext.getDesignHandle().findElement(s);
lbl.setText(s + "this works");
lblStyle = lbl.getPrivateStyle();
var bgColor = lblStyle.getBackgroundColor();
bgColor.setRGB(0xA9A9A9 ); //set the background color
columncount +=1
} while (columncount < 4);
rowcount +=1
} while (rowcount < 4);
DEV SAHU
<blockquote class='ipsBlockquote' data-author="'bricombs'" data-cid="115330" data-time="1363973512" data-date="22 March 2013 - 10:31 AM"><p>
Good Day<br />
Your new question appears to be a different topic then your original question. However you can code your report so that a single letter will display in each cell. Two ways that come to mind are the following:<br />
1. Create a table and bind it to your dataset. Then use the Dynamic Text Report Item to display only a single letter. For example if you create a 20 column by 2 row report you can do the following. <br />
Create a globel vareable in the report initialize: GCounter = 0;<br />
Then in the first Colunm of each detal row add code like the following:<br />
GCounter = 0<br />
row["ADDRESSLINE1"].substr(GCounter,1);<br />
Then for all other columns in the row you will have the following code:<br />
GCounter +=1;<br />
row["ADDRESSLINE1"].substr(GCounter,1);<br />
<br />
Of course you will want to add some logic to so you to check for the end of the string so you can display blanks if it ends before the last column. <br />
<br />
2. If you want to do it all by code and use a grid with labels you could do the following:<br />
Use a naming convention so you know where each label is in the grid. For example:<br />
r1c1 r1c2 r1c3<br />
r2c1 r2c2 r2c3<br />
<br />
You can then create a loop in the Grid onPrepare that sets the value of each label. example code that does this for a 3x3 grid.<br />
<br />
var rowcount = 1;<br />
var columncount = 1;<br />
<br />
do<br />
{<br />
columncount = 1; //reset the column count to one as we are on a new row.<br />
do<br />
{<br />
var s = "r" + rowcount + "c" + columncount;<br />
lbl =reportContext.getDesignHandle().findElement(s);<br />
lbl.setText(s + "this works"); <br />
lblStyle = lbl.getPrivateStyle();<br />
var bgColor = lblStyle.getBackgroundColor();<br />
bgColor.setRGB(0xA9A9A9 ); //set the background color <br />
columncount +=1<br />
} while (columncount < 4);<br />
rowcount +=1<br />
} while (rowcount < 4);<br /></p></blockquote>
<br />
<br />
<br />
Hi Britcomb,<br />
<br />
Greetings of the day...<br />
Thanx for the quick reply...<br />
we are able to do what we were trying to achieve.