Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide 2 columns based on prompt values 2

Status
Not open for further replies.

PreetiGanamani

Programmer
Jan 2, 2006
22
0
0
US
Hello,
i really need help with this...
I have to add the option of hiding or showing 2 columns.
these are the steps i followed but i can see all the columns in the report irrespective of the selection at the prompt.

please do let me know if i am doing something wrong or if i need to do something else.

STEPS:

1) In the prompt page ,insert a value prompt. The wizard asks whether you want to create a new or use an existing parameter. Select "Create a new parameter" and choose a name (Parameter1) --> click finish.
2) Select the property "Static Choices" of the value prompt. Add 2 new choices (e.g. Use: w , Display: with column A; Use: o , Display: without column A).
3) Add a new variable (File -> Variables...) with Type "String" and a name ( e.g. "hide"). In the Layout Expression window choose the Parameter Tab and double-click on your parameter (e.g. Parameter1). In the Expression Definition ParamDisplayValue("Parameter1") is displayed. Change this to ParamValue("Parameter1").
Add two values to the variable (e.g "w" for with and "o" for without column - this have to be the same as the "use" in the property "Static Choices" of the value prompt).
4) Click on the list column you want to hide. Then select the property "Conditional Style" and choose your previously added variable (with both values marked).
5) Click on the Condition Explorer and then your variable with the value for hiding the column ( e.g. o). Select for the list column the property "Box Type" and change the value to "None" - the list column disappears.
6) Leave the Conditional View by double-clicking the green bar (the explorer-bar changes to green when report studio is in conditional view).

I followed the steps taken from a previous post by timida.

When i do this the 2 columns are hidden from the report page but when i run the report both of these columns are displayed.Not sure how to go about it from here...
Lohita
 
Hi,

The one bit missing from this is that you need to use the parameter in your query in order for the prompt to be issued. You can achieve this as follows:

7) Go to the Query Explorer and select Query1.
8) From the toolbox, drag a data item into the Facts area. For the expression, go the the Paramaters tab and drag in Parameter1 so your expression reads ?Parameter1?
9) In the properties of the data item, change the Name to Prompter (or something similar).
10) Run the report, and the prompt should now display and your report should start to work as you expect.

Best regards,

MF.
 
Hello mfgf,
Thnaks for the reply.I followed the steps given by you, but it still did not work for me...

Might be i should rephrase my question...

The prompt is displayed when i run my report..it is just that irrespective of what my selection at the prompt is the report displays all the columns..


Please do help me out with this...
Thanks
Lohita
 
Here's the same report written using the sample GO Sales and Retailers package, and this works OK. Can you compare this with your example to see what's different?

Regards,

MF.

<report xml:lang="en-gb" xmlns=" <modelConnection name="/content/package[@name='GO Sales and Retailers']/model[@name='model']"/>
<querySet xml:lang="en-gb">
<BIQuery name="Query1">
<cube><factList><item refItem="Product line" aggregate="none"/><item refItem="Product type" aggregate="none"/><dataItem aggregate="none" name="Prompter"><expression>?Parameter1?</expression></dataItem></factList></cube>
<tabularModel><dataItem name="Product line" aggregate="none"><expression>[gosales_goretailers].[Products].[Product line]</expression></dataItem><dataItem name="Product type" aggregate="none"><expression>[gosales_goretailers].[Products].[Product type]</expression></dataItem></tabularModel></BIQuery>
</querySet>
<layoutList>
<layout>

<promptPageList><page name="Prompt Page1">
<pageHeader>
<block class="reportTitle">
<textItem class="reportTitleText">
<text/>
</textItem>
</block>
<style>
<CSS value="padding-bottom:10px"/>
</style>
</pageHeader>
<pageBody>
<style>
<CSS value="padding:12px"/>
</style>
<selectValue parameter="Parameter1"><selectOptions><selectOption useValue="w"><displayValue value="With Product Type"/></selectOption><selectOption useValue="o"><displayValue value="Without Product Type"/></selectOption></selectOptions></selectValue>
</pageBody>
<pageFooter>
<style>
<CSS value="padding:12px;border-top:1pt solid #999999"/>
</style>
<promptButton type="cancel">
<style>
<CSS value="margin-right:7px"/>
</style>
</promptButton>
<promptButton type="back">
<style>
<CSS value="margin-right:7px"/>
</style>
</promptButton>
<promptButton type="next">
<style>
<CSS value="margin-right:7px"/>
</style>
</promptButton>
<promptButton type="finish"/>
</pageFooter>
</page>
</promptPageList><pageSet>

<page name="Page1">
<pageBody>
<list refQuery="Query1">
<listColumnTitles><listColumnTitle><textItem><queryItemRef refItem="Product line" content="label"/></textItem></listColumnTitle><listColumnTitle><textItem><queryItemRef refItem="Product type" content="label"/></textItem></listColumnTitle></listColumnTitles>
<listColumns><listColumn><textItem><queryItemRef refItem="Product line"/></textItem></listColumn><listColumn><textItem><queryItemRef refItem="Product type"/></textItem><conditionalStyle refVariable="Hide"><style/><style refVariableValue="w"/><style refVariableValue="o"><CSS value="display:none"/></style></conditionalStyle></listColumn></listColumns>
<style>
<CSS value="border-collapse:collapse"/>
</style>
<XMLAttribute name="RS_ListGroupInfo" value=""/></list>
</pageBody>
<pageHeader>
<block class="reportTitle">
<textItem class="reportTitleText">
<text/>
</textItem>
</block>
<style>
<CSS value="padding-bottom:10px"/>
</style>
</pageHeader>
<pageFooter>
<table>
<tableRow>
<tableCell>
<textItem>
<expression>AsOfDate()</expression>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:left;width:25%"/>
</style>
</tableCell>
<tableCell>
<textItem>
<text>- </text>
</textItem>
<textItem>
<expression>PageNumber()</expression>
</textItem>
<textItem>
<text> -</text>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:center;width:50%"/>
</style>
</tableCell>
<tableCell>
<textItem>
<expression>AsOfTime()</expression>
</textItem>
<style>
<CSS value="vertical-align:top;text-align:right;width:25%"/>
</style>
</tableCell>
</tableRow>
<style>
<CSS value="border-collapse:collapse;width:100%"/>
</style>
</table>
<style>
<CSS value="padding-top:10px"/>
</style>
</pageFooter>
</page></pageSet></layout>
</layoutList>
<variableList><variable name="Hide" type="string"><expression>ParamValue("Parameter1")</expression><variableValueList><variableValue value="w"/><variableValue value="o"/></variableValueList></variable></variableList></report>
 
hello,
i don't have access to crn right now, so i can't see your report, but make sure you use Prompter as suggested earlier for your conditional formatting and nto the other variable you had earlier.
 
Hi lohita,

I just asked you a few question in the other thread. I didn't saw that you opened a new one.
Well you followed the above mentioned steps and you inserted the parameter (variable) to your query.
And you are able to see your prompt, but there is no effect to the columns.

* What are the values of your variable and what type of variable you used?
* In the Expression Definition of your variable what is displayed? ParamDisplayValue("yyyy") or ParamValue("yyyy").
* What are the static values of your prompt ("use" and "display" values)?
* Click on the condition explorer and then on your variable with the value for hiding the columns. Are the columns displayed or hided?
* If you leave the condition explorer - the 2 columns should be displayed again...

kr, Timida


 
Hi Timida,
Thanks for replying to my post.
* i've used a string Variable.
the values that i have used for it are
By Date
By Period

* ParamDisplayValue("yyyy") is displayed. i changed it to
ParamValue("yyyy").

* The Static values are
use Display
1 By Date
2 By Period

* when i click on the condition explorer and then on the variable with the value for hiding the columns, the columns are hidden.

* When i leave the condition explorer - the 2 columns are displayed again.

Thanks for your help...

 
Hi lohita,

does it work now?

I suppose there is still one mistake..
When your variable has the values "By Date" and "By Period", than you have to use "ParamDisplayValue("yyyy") so that the variable is compared to the Dispaly value of the prompt.

However I would recommend that you use the "use" values of the prompt (in your case 1 and 2), so that there is no problem with spelling mistakes or spaces...
Which means that you define the values "1" and "2" for your variable (instead of "by date" and "by period") and use "ParamValue("yyyy")" in the expression window.

hope that helps
Timida
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top