If you are unable to create a new account, please email support@bspsoftware.com

 

News:

MetaManager - Administrative Tools for IBM Cognos
Pricing starting at $2,100
Download Now    Learn More

Main Menu

Different background color for text item when using Style Variable

Started by sanchoniathon, 07 Apr 2014 10:17:47 AM

Previous topic - Next topic

sanchoniathon

Hi to all,

- We have this STRING Variable that has the following code:
if ( [Query1].[Profit] >[Query1].[Profit LastYear])
   then ('high')
else   ('low')

- We then apply this Variable to the "Syle Variable" propertie of a tex object in order to be able to change the background color of it so that it can
be red of lower or green if greater

- The problem is that when we apply this and we validate the report we receive the following errir message:
RSV-VAL-0032 The following expression is not valid:
if ( [Query1].[Profit] >[Query1].[Profit LastYear])
   then ('high')
else   ('low')

If the item exists in a query but is not referenced in the layout, add it to a property list. CRX-API-0005 An error ocurred at or near the position '5'.
The variable named '[Query1].[Profit]' is invalid.


But i know that the [Query1].[Profit]' is working fine inside a list object.

Should i use Conditional Style or render variable instead ?

Thanks for any valuable feed-back !


MFGF

Sounds like the approach you are using ought to work. Can you confirm that the object you are conditionally highlighting is associated with Query1?

MF.
Meep!

sanchoniathon

Wow quick feed-back,

I'm not quite sure how to determine that in fact maybe that's the problem ? I don't see any PROPERTY or query values that i can specify for a TEXT item ?

Lynn

You need to have both [Query1].[Profit] and [Query1].[Profit LastYear] either in your layout or else included in the "Properties" property of your list.

If both are not in your layout then navigate to the List properties using the ancestor button and look for a property called Properties. No, I'm not making this up. It is in the data section of the list properties. It will bring up a list of all the items in your query. Click the check box next to the one(s) not in your layout.

sanchoniathon

Hi Lynn,

I'm sorry as i might not have explained myself correctly:

1- I have a TABLE object with 1 column and 2 rows

2- In the first ROW i have a LIST object that is from Query1 that displays the 2 data items mentionned in earlier post that is:
[Query1].[Profit] and [Query1].[Profit LastYear]


3- In the 2nd ROW i added a simple TEXT object (alone not in any way physically attached to the LIST) which has the property "Style Variable" pointing to the String Variable which i mentionne earlier.

4- So in relation to what you mentioned in your last post: "You need to have both [Query1].[Profit] and [Query1].[Profit LastYear] either in your layout"
==> I presume i can dismiss this suggestion as for they are already beeing displayed in the list report?

I hope i'm not missing anything ?

Thank you in advance for your feed-back !


p.s In fact i don't know if anyone has any other suggestion in doing what i'm trying to reproduce, that is: If the value of [Query1].[Profit] is greater than the
value of [Query1].[Profit LastYear] then we need to eighter display a TEXT with a different color or even better simply fill in a box objet by red (lower) or yellow (equal)
or green (greater)

Lynn

Ah, well that is a different kettle of fish.

Query items need to be in layout containers typically. These include lists, crosstabs, singletons, repeaters and so on. It is, however, also possible to associate a query with a page and then place query items anywhere you like. You should be sure you understand what SQL is being generated in this sort of scenario.

Assuming your query returns expected results for the way you are using it, then try associating the query to the page and then check the boxes for the necessary profit items that your style is based on in the Properties property for the page level.

Personally I prefer conditional styles over style variables. It just seems more straightforward and compact to me. You would still need to have the proper association of queries/layouts/properties but you can look at a conditional style and see all in what place what the colors and styles for each possible outcome are without messing around in the condition explorer.

MFGF

Quote from: Lynn on 07 Apr 2014 01:49:10 PM
Assuming your query returns expected results for the way you are using it, then try associating the query to the page and then check the boxes for the necessary profit items that your style is based on in the Properties property for the page level.

My apologies - this is what I was alluding to earlier. I should have been more specific. Thanks, Lynn, for taking the time to detail the approach. My only (lame) excuse was that I was packing up to head home and not entirely focused :)

Cheers!

MF.
Meep!

sanchoniathon

Excellent,

Thank you Lynn and MFGF i no longer have that issue.

Although, i'm now trying to insert a GAUGE graphic on a 3rd ROW of the same TABLE object and using same QUERY1, but when i start by adding do ADD data item in the SERIES (needles) and VALIDATE the report i receive the following error message:
"RSV-VAL-0010 Failed to load the report specification. RSV-VAL-0021 The master-detail link is missing from the crosstab or chart."

I will continue searching and if necessary i might open another post in this GREAT fast feed-back cognos forum.

:)

MFGF

Hmmm. I suspect this is because Query1 is associated with your page and your chart is also on the page and associated with Query1. An easy fix is to go to the Query Explorer, select Queries, right-click Query1 and copy, right-click and paste to create a new query with the same contents (Query2), then associate your chart with Query2.

Cheers!

MF.
Meep!

sanchoniathon

In deed that's what i did before my lunch time and it DID work and now i see that you posted this suggestion.
:)

sanchoniathon


sanchoniathon

Oh shoooot ...

Hi to all again,

1- I managed to get rid of the infamous error message by following advices in this post
2- I now have 3 lists pointing to the same "Query2"
3- I also have 3 charts pointing to a copy of "Query2" which is named "Query3"
4- I have an "image" pointing to a "Style variable" that has code that reffers to "Query2"
5- The "PAGE" is pointing to "Query2"

I validate the report and it runs ok.

I decide to add another "image" that points to another "Style Variable" that has code that reffers to same "Query2". I validate the report and i get the same error message:

RSV-VAL-0032 The following expression is not valid:
if ( [Query2].[Margin$] > [Query2].[Margin$ LastYear] )
   then ('High')
else   ('Low').
If the item exists in a query but is not referenced in the layout, add it to a property list.
CRX-API-0005 An error ocurred at or near the position '5'.
The variable named '[Query2].[Margin$]' is invalid.

The 3 "list" objects beeing displayed are actually displaying all columns beeing reffered in the both "Style Variable".

QUESTION: What is the logic to get rid of this type of reaction from ReportStudio ? Does it mean i need to create another copy of Query2 and name it "Query4" for example and point
one object of the report to that new Query4 ? I'm not sure what the logic is supposed to be. Does it means i need to creat a QUERY object for every list i'm displaying ?

Thanks !

sanchoniathon

QUESTION:

1- I originally created ONE query containing ALL data items i needed
2- I then created a 6row X 3colum TABLE object


3- 1fst row contains 3 LIST objects
4- 2nd row contains 3 IMAGE ojects reacting (displaying a green or red flag) depending on the 3 LIST objects just above


5- 3rd row contains 3 LIST objects
6- 4th row contains 3 GRAPH objects reacting depending on the 3 LIST objects just above

7- 5th row contains 3 LIST objects
8- 6th row contains 3 IMAGE objects reacting (displaying a green or red flag) depending on the 3 LIST objects just above


As mentionned in previous posts, because i was receving the infamous error message:
RSV-VAL-0032 The following expression is not valid:
if ( [Query2].[ColumnName$] > [Query2].[ColumnName LastYear] )
   then ('High')
else   ('Low').
If the item exists in a query but is not referenced in the layout, add it to a property list.
CRX-API-0005 An error ocurred at or near the position '5'.
The variable named '[Query2].[ColumnName$]' is invalid


i had to follow this post suggestions that was to simply copy the original query and then point some graph objects to this newly
copied query and do it again if needed and it some kind of worked until a certain amount of objects been added.

QUESTION: What is the best practice in ReportStudio (if exists) when dealing with many different objects (LIST, graphs and images) beeind displayed on the same page and coming from the same
query ? should i in fact create a QUERY for every object beeind displayed wnd to only have the necessary columns in each of those queries  and so on ?

Thanks in advance !

xavier

WOW,so , what's the solution? haven't see it ,I also have this problem,,,,so help me