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

Formatting a number --> formatting a month name language

Started by RudiHendrix, 29 Aug 2010 03:09:27 AM

Previous topic - Next topic

RudiHendrix

In my report I want to present the y-axis of a chart in a specific format depending on a database value.

If the database value is 'Nederlands' I want the number format to be ###.###,## If the database value is 'Engels' I want the number format to be ###,###.##
Now, I've managed to get the title of the chart to change based upon this value by using a string variable. But it seems as if the number format of the field that I use in the series of the chart cannot be changed conditionally based on a string variable.

Am I looking in the wrong place?

To be on the safe side: I am NOT looking for a language variable. It doesn't matter in what language Cognos runs, because this report is being E-mailed to the user.

RudiHendrix

Ahum...this was pretty easy...
Just select the variable and select the y-axis and make the appropriate changes in the conditional property.

Got the solution from ittoolbox.com

Ahum...now I still have another question... On the x-axis I have the months of the year. Is it possible to change the expression of a data item to be changed based upon this language data item? In case of 'Engels' it should display the month name in English in case of 'Nederlands' it should display the month name in Dutch.

I tried
If
([Query7].[Tekstwaarde] = 'Engels')
Then
(to_char([Query1].[DATES_VOL_MAAND];'Month';'NLS_DATE_LANGUAGE=english')
Else
(to_char([Query1].[DATES_VOL_MAAND];'Month';'NLS_DATE_LANGUAGE=dutch')

But this returns an error... obviously because it is a text and no data item against which the chart can be plotted.
But if I insert this as a report expression I get an error as well. Stating that the expression is invalid.

If I add a new data item containing the code above and tell Cognos to use that data item as the Source of the Text Source it returns an error as well.

If I do something like this:
If
([Query7].[Tekstwaarde] = 'Engels')
Then
('English')
Else
('Nederlands')

It does state that specific value for every month displayed.

What am I still doing wrong? :(

RudiHendrix

I just made a case statement that "reads" the current value and displays the required value accordingly. It is not the best solution but it works.

If
([Query8].[EMAIL_LANGUAGE] = 'Engels')
Then
(Case(substr([Query8].[DATES_VOL_MAAND];0;3))
When ('Jan') Then ('Jan ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Feb') Then ('Feb ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Mrt') Then ('Mar ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Apr') Then ('Apr ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Mei') Then ('May ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Jun') Then ('Jun ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Jul') Then ('Jul ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Aug') Then ('Aug ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Sep') Then ('Sep ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Okt') Then ('Oct ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Nov') Then ('Nov ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Dec') Then ('Dec ' || substr([Query8].[DATES_VOL_MAAND];5))
End
)
Else
(
Case(substr([Query8].[DATES_VOL_MAAND];0;3))
When ('Jan') Then ('Jan ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Feb') Then ('Feb ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Mrt') Then ('Mrt ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Apr') Then ('Apr ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Mei') Then ('Mei ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Jun') Then ('Jun ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Jul') Then ('Jul ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Aug') Then ('Aug ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Sep') Then ('Sep ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Okt') Then ('Okt ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Nov') Then ('Nov ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Dec') Then ('Dec ' || substr([Query8].[DATES_VOL_MAAND];5))
End
)

blom0344

A trifle shorter (?):



If
([Query8].[EMAIL_LANGUAGE] = 'Engels')
Then
(Case(substr([Query8].[DATES_VOL_MAAND];0;3))
When ('Jan') Then ('Jan ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Feb') Then ('Feb ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Mrt') Then ('Mar ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Apr') Then ('Apr ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Mei') Then ('May ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Jun') Then ('Jun ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Jul') Then ('Jul ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Aug') Then ('Aug ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Sep') Then ('Sep ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Okt') Then ('Oct ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Nov') Then ('Nov ' || substr([Query8].[DATES_VOL_MAAND];5))
When ('Dec') Then ('Dec ' || substr([Query8].[DATES_VOL_MAAND];5))
End
)
Else
(
substr([Query8].[DATES_VOL_MAAND];0;3)|| substr([Query8].[DATES_VOL_MAAND];5)
End
)

RudiHendrix

Exactly...that is possible. I did this in case they think of yet another notation again.