Hi
i created package in FWM, now i want create 2 years difference with TEXT BOX PROMPT
like one TEXT BOX PROMPT 201109 another TEXT BOX PROMPT 201011 , Here In data YEAR (2006 TO 2011 )QUEREY SUBJECT IS THERE and for the MONTH( BALANCE-01 to BALANCE-12 )is there , now i want to create 2TEXT BOX PROMPT(eg:201110 and 201011 )and Difference between 2years.
pleae help
Thanks & Regards
Anil K.Marri
As Far I can understand you have something like the following:
Year Month Value
2006 Balance-01 200
2006 Balance-02 100
....
2007 Balance-01 300
Is not clear to me if you want the difference of the selected dates or the difference of the values of the two selected dates.
I propose to create a data item that will have the format YYYYMM
You can achieve this like
[Year]*100 + cast_integer(right([Month],2)
lets say that the above is name cYear
Then create two data items one for each selection
FirstYearValues:
if ([sYear] = ?FromYear?) then ([Value) else (0)
SecondYearValues:
if ([sYear] = ?ToYear?) then ([Value) else (0)
And finally a third data item with the difference
[FirstYearValues] - [SecondYearValues]
Hi Pricter
Thanks a lot for reply, my problem is
i have query subject called FINANCIAL_HISTORY_DETAILS, it contains QUERY ITEMS like YEAR(2006 TO 2011) ,BALANCE_1(1ST MONTH UP TO BALANCE_12(Last_month)). Balance_1 means it contains Values as well as we can take it as Month also
Now i need to merge YEAR AND BALANCE_01 UP TO BALANCE_12, CREATE text Box PROMPT
two Text Box Prompt(users can enter like 201110,201010) then difference between two years Data.
in 1st TEXT BOX PROMPT(201011(they can enter any year and month)) 2nd TEXT BOX PROMPT(201110((they can enter any year and month)) and VARIANCE(Diff Between TWO PROMPTS
Thanks & Regards
Anil K.Marri
So my proposed solution I think works for you. Did you try it?
If you want to go a step further you can perform some check some validations what the user writes on the text prompt
by javascript.
Hi Pricter
Thank you
But Here MONTH QUERY ITEM is not there , BALANCE_1 up to BALANCE_12(12 QUERY ITEMS are there) I Want to Concanate with YEAR(2006 up to 2011),Then create TEXT BOX PROMPTS
YEAR
2006 BALANCE_01 up to BALANCE_12(This is Months 1 to 12)
2007 BALANCE_01 up to BALANCE_12
2008 BALANCE_01 up to BALANCE_12
2009 BALANCE_01 up to BALANCE_12
2010 BALANCE_01 up to BALANCE_12
2011 BALANCE_01 up to BALANCE_12
Based on this I Want to create 2 TEXT BOX Prompts and Difference Between 2 yrs.
1 TEXT BOX PROMPTS user enter YEAR MONTHlike(eg:201110) 2) TEXT BOX PROMPTS user enter YEAR MONTHlike(eg:201010) and I need Difference Between to these
Thanks & Regards
Anil K.Marri
So to make it clear do you have balances only for the 12 or for other months also?
If is the first case then use only the year. For example round((?FromData?/100),0) it will give the year
If you have balance for the twelve months
then by solution I propose in which it takes the last two characters of the balance data item
for example
BALANCE_01 up to BALANCE_08
it will give
08
then converted into integer
so 8
and then add it to the year * 100
so
200600 + 8 = 200608
Hi pricter
So to make it clear do you have balances only for the 12 or for other months also?
For all the BALANCE_1 TO BALANCE_12 have data
Please provide Steps, how can bring YEAR and BALANCE_01 to BALANCE_12 together in to Prompts
Regards
Anil K.Marri
I am confused.
You say that you do not have a month column but you have data for the 12 months. How you differentiate the month data?
What I am saying that all the "work" should be done in the query and not in the text prompt.
Hi pricter
case when (? Input Month Number ? =1 or ? Input Month Number ? =01) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_01]
when (? Input Month Number ? =2 or ? Input Month Number ? =02) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_02]
when (? Input Month Number ? =3 or ? Input Month Number ? =03) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_03]
when (? Input Month Number ? =4 or ? Input Month Number ? =04) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_04]
when (? Input Month Number ? =5 or ? Input Month Number ? =05) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_05]
when (? Input Month Number ? =6 or ? Input Month Number ? =06) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_06]
when (? Input Month Number ? =7 or ? Input Month Number ? =07) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_07]
when (? Input Month Number ? =8 or ? Input Month Number ? =08) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_08]
when (? Input Month Number ? =9 or ? Input Month Number ? =09) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_09]
when ? Input Month Number ? =10 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_10]
when ? Input Month Number ? =11 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_11]
when ? Input Month Number ? =12 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_12]
else
0
end
By using this CASE STATEMENT i can creat 2 MONTHS like MONTH_NUMBER,MONTH_NUMBER1
using 2 MONTH_NUMBER and MONTH_NUMBER1 i can create TEXT BOX PROMPTS
here MOnths will work where as we can't enter YEAR , i dont know how to include YEAR by using YEAR query item
Thansk & Regards
Anil K.marri
Now I understand that you have columns for each month.
So
Create two query items one for each selection in order to take the right column for the month
name data item "FromDateMonth"
case right(cast_char(?FromDate?),2)
when ('01') then [Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_01]
when ('02') then [Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_02]
and so on
for the second (name data time "ToDateMonth")
case right(cast_char(?ToDate?),2)
when ('01') then [Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_01]
when ('02') then [Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_02]
Then create two data items
Name Data Item : "Values From Year" with the expression
if ([Year]= round((?Fromdate?*100),2) then ([From Date Month]) else (0)
Name Data Item : "Values To Year" with the expression
if ([Year]= round((?Todate?*100),2) then ([ToDateMonth]) else (0)
And then a data item to minus the one data item from other
[Values To Year] - [Values To Year]
PS: I think if you play with macro you can achieve the "months" data item with less codes and without the case statement. Unfortunately I do not have report studio in front of me to tested it.
Hi Pricter
Thank you for help
but it's not working empty columns coming
Thanks & Regards
Anil K.Marri
Previously I made a type
instead of
round((?Todate?*100),0)
use
round((?Todate?/100),0)
It gives null value cause I forgot rtrim
instead of
right(cast_char(?FromDate?),2)
try
right(rtrim(cast_char(?FromDate?)),2)
and the same for the Todate
Does it work now?
Hi Pricter,
thank you Its not working
iam trying
Regards
Anil K.Marri
At which point it does not work?
Hi Pricter
Please see the data
---------------------------------------------------------------------------------------------------------------------------
<report xmlns="http://developer.cognos.com/schemas/report/4.0/" expressionLocale="en-us">
<modelPath>/content/folder[@name='UAT']/package[@name='Customers']/model[@name='2011-11-27T12:07:13.474Z']</modelPath>
<queries>
<query name="Query1">
<source>
<model/>
</source>
<selection><dataItem name="BALANCE_01" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_01]</expression></dataItem><dataItem name="BALANCE_02" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_02]</expression></dataItem><dataItem name="BALANCE_03" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_03]</expression></dataItem><dataItem name="BALANCE_04" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_04]</expression></dataItem><dataItem name="BALANCE_05" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_05]</expression></dataItem><dataItem name="BALANCE_06" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_06]</expression></dataItem><dataItem name="BALANCE_07" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_07]</expression></dataItem><dataItem name="BALANCE_08" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_08]</expression></dataItem><dataItem name="BALANCE_09" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_09]</expression></dataItem><dataItem name="BALANCE_10" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_10]</expression></dataItem><dataItem name="BALANCE_11" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_11]</expression></dataItem><dataItem name="BALANCE_12" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_12]</expression></dataItem><dataItem name="FRAS_BASE" aggregate="none" rollupAggregate="none"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[FRAS_BASE]</expression></dataItem><dataItem name="BASE_NAME" aggregate="none" rollupAggregate="none"><expression>[Customers].[CUSTOMERS].[BASE_NAME]</expression></dataItem><dataItem name="LEB_DESCRIPTION" aggregate="none" rollupAggregate="none"><expression>[Customers].[LE_BOOK].[LEB_DESCRIPTION]</expression></dataItem><dataItem name="Month_Number"><expression>(?YEAR?)+
case when (? Input Month Number ? =1 or ? Input Month Number ? =01) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_01]
when (? Input Month Number ? =2 or ? Input Month Number ? =02) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_02]
when (? Input Month Number ? =3 or ? Input Month Number ? =03) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_03]
when (? Input Month Number ? =4 or ? Input Month Number ? =04) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_04]
when (? Input Month Number ? =5 or ? Input Month Number ? =05) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_05]
when (? Input Month Number ? =6 or ? Input Month Number ? =06) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_06]
when (? Input Month Number ? =7 or ? Input Month Number ? =07) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_07]
when (? Input Month Number ? =8 or ? Input Month Number ? =08) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_08]
when (? Input Month Number ? =9 or ? Input Month Number ? =09) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_09]
when ? Input Month Number ? =10 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_10]
when ? Input Month Number ? =11 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_11]
when ? Input Month Number ? =12 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_12]
else
0
end
</expression></dataItem><dataItem name="Month_Number1"><expression>(?YEAR1?)+
case when (? Month Number ? =1 or ? Month Number ? =01) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_01]
when (? Month Number ? =2 or ? Month Number ?=02) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_02]
when (? Month Number ? =3 or ? Month Number ? =03) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_03]
when (? Month Number ? =4 or ? Month Number ? =04) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_04]
when (? Month Number ? =5 or ? Month Number ? =05) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_05]
when (? Month Number ? =6 or ? Month Number ? =06) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_06]
when (? Month Number ? =7 or? Month Number ?=07) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_07]
when (? Month Number ? =8 or ? Month Number ?=08) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_08]
when (? Month Number ? =9 or ? Month Number ? =09) then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_09]
when ? Month Number ? =10 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_10]
when ? Month Number ? =11 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_11]
when ? Month Number ? =12 then
[Customers].[FINANCIAL_HISTORY_DETAILS].[BALANCE_12]
else
0
end
</expression></dataItem><dataItem name="CURRENCY" aggregate="none" rollupAggregate="none"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[CURRENCY]</expression></dataItem><dataItem name="YEAR" aggregate="total"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[YEAR]</expression></dataItem></selection>
<detailFilters><detailFilter><filterExpression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BAL_TYPE]=1</filterExpression></detailFilter><detailFilter use="optional"><filterExpression>[Customers].[FINANCIAL_HISTORY_DETAILS].[COUNTRY] = ?COUNTRY?</filterExpression></detailFilter><detailFilter use="optional"><filterExpression>[Customers].[FINANCIAL_HISTORY_DETAILS].[LE_BOOK] = ?LE_BOOK?</filterExpression></detailFilter><detailFilter use="optional"><filterExpression>[Customers].[FINANCIAL_HISTORY_DETAILS].[BS_GL] = ?BS_GL?</filterExpression></detailFilter></detailFilters></query>
<query name="Query2"><source><model/></source><selection><dataItem name="COUNTRY" aggregate="none"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[COUNTRY]</expression></dataItem></selection></query><query name="Query3"><source><model/></source><selection><dataItem name="LE_BOOK" aggregate="none"><expression>[Customers].[FINANCIAL_HISTORY_DETAILS].[LE_BOOK]</expression></dataItem></selection></query></queries>
<layouts>
<layout>
<reportPages>
<page name="Page1"><style><defaultStyles><defaultStyle refStyle="pg"/></defaultStyles></style>
<pageBody><style><defaultStyles><defaultStyle refStyle="pb"/></defaultStyles></style>
<contents>
<crosstab refQuery="Query1" horizontalPagination="true" name="Crosstab1">
<crosstabCorner><style><defaultStyles><defaultStyle refStyle="xm"/></defaultStyles></style><contents/></crosstabCorner>
<style>
<defaultStyles>
<defaultStyle refStyle="xt"/>
</defaultStyles>
<CSS value="border-collapse:collapse"/>
</style>
<crosstabFactCell><contents><textItem><dataSource><cellValue/></dataSource></textItem></contents><style><defaultStyles><defaultStyle refStyle="mv"/></defaultStyles></style></crosstabFactCell><crosstabRows><crosstabNode><crosstabNestedNodes><crosstabNode><crosstabNestedNodes><crosstabNode><crosstabNodeMembers><crosstabNodeMember refDataItem="CURRENCY" edgeLocation="e5"><style><defaultStyles><defaultStyle refStyle="ml"/></defaultStyles></style><contents><textItem><dataSource><memberCaption/></dataSource></textItem></contents></crosstabNodeMember></crosstabNodeMembers></crosstabNode></crosstabNestedNodes><crosstabNodeMembers><crosstabNodeMember refDataItem="BASE_NAME" edgeLocation="e4"><style><defaultStyles><defaultStyle refStyle="ml"/></defaultStyles></style><contents><textItem><dataSource><memberCaption/></dataSource></textItem></contents></crosstabNodeMember></crosstabNodeMembers></crosstabNode></crosstabNestedNodes><crosstabNodeMembers><crosstabNodeMember refDataItem="FRAS_BASE" edgeLocation="e3"><style><defaultStyles><defaultStyle refStyle="ml"/></defaultStyles></style><contents><textItem><dataSource><memberCaption/></dataSource></textItem></contents></crosstabNodeMember></crosstabNodeMembers></crosstabNode></crosstabRows><crosstabColumns><crosstabNode><crosstabNodeMembers><crosstabNodeMember refDataItem="Month_Number" edgeLocation="e1"><style><defaultStyles><defaultStyle refStyle="ml"/></defaultStyles></style><contents><textItem><dataSource><memberCaption/></dataSource></textItem></contents></crosstabNodeMember></crosstabNodeMembers></crosstabNode><crosstabNode><crosstabNodeMembers><crosstabNodeMember refDataItem="Month_Number1" edgeLocation="e2"><style><defaultStyles><defaultStyle refStyle="ml"/></defaultStyles></style><contents><textItem><dataSource><memberCaption/></dataSource></textItem></contents></crosstabNodeMember></crosstabNodeMembers></crosstabNode></crosstabColumns></crosstab>
</contents>
</pageBody>
<pageHeader>
<contents>
<block><style><defaultStyles><defaultStyle refStyle="ta"/></defaultStyles></style>
<contents>
<textItem><style><defaultStyles><defaultStyle refStyle="tt"/></defaultStyles></style>
<dataSource>
<staticValue/>
</dataSource>
</textItem>
</contents>
</block>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="ph"/>
</defaultStyles>
<CSS value="padding-bottom:10px"/>
</style>
</pageHeader>
<pageFooter>
<contents>
<table>
<tableRows>
<tableRow>
<tableCells>
<tableCell>
<contents>
<date>
<style>
<dataFormat>
<dateFormat/>
</dataFormat>
</style>
</date>
</contents>
<style>
<CSS value="vertical-align:top;text-align:left;width:25%"/>
</style>
</tableCell>
<tableCell>
<contents>
<pageNumber/>
</contents>
<style>
<CSS value="vertical-align:top;text-align:center;width:50%"/>
</style>
</tableCell>
<tableCell>
<contents>
<time>
<style>
<dataFormat>
<timeFormat/>
</dataFormat>
</style>
</time>
</contents>
<style>
<CSS value="vertical-align:top;text-align:right;width:25%"/>
</style>
</tableCell>
</tableCells>
</tableRow>
</tableRows>
<style>
<defaultStyles>
<defaultStyle refStyle="tb"/>
</defaultStyles>
<CSS value="border-collapse:collapse;width:100%"/>
</style>
</table>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="pf"/>
</defaultStyles>
<CSS value="padding-top:10px"/>
</style>
</pageFooter>
</page>
</reportPages>
<promptPages><page name="Prompt Page1">
<pageHeader>
<contents>
<block>
<contents>
<textItem>
<dataSource>
<staticValue/>
</dataSource>
<style>
<defaultStyles>
<defaultStyle refStyle="tt"/>
</defaultStyles>
</style>
</textItem>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="ta"/>
</defaultStyles>
</style>
</block>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="hp"/>
</defaultStyles>
</style>
</pageHeader>
<pageBody>
<contents><selectWithTree parameter="COUNTRY" refQuery="Query2" multiSelect="false" required="false"><selectWithTreeItem refDataItem="COUNTRY"/></selectWithTree><selectWithTree parameter="LE_BOOK" refQuery="Query3" multiSelect="false" required="false"><selectWithTreeItem refDataItem="LE_BOOK"/></selectWithTree><textBox parameter="BS_GL" multiSelect="false" required="false"/></contents>
<style>
<defaultStyles>
<defaultStyle refStyle="py"/>
</defaultStyles>
</style>
</pageBody>
<pageFooter>
<contents>
<promptButton type="cancel">
<contents/>
<style>
<defaultStyles>
<defaultStyle refStyle="bp"/>
</defaultStyles>
</style>
</promptButton>
<promptButton type="back">
<contents/>
<style>
<defaultStyles>
<defaultStyle refStyle="bp"/>
</defaultStyles>
</style>
</promptButton>
<promptButton type="next">
<contents/>
<style>
<defaultStyles>
<defaultStyle refStyle="bp"/>
</defaultStyles>
</style>
</promptButton>
<promptButton type="finish">
<contents/>
<style>
<defaultStyles>
<defaultStyle refStyle="bp"/>
</defaultStyles>
</style>
</promptButton>
</contents>
<style>
<defaultStyles>
<defaultStyle refStyle="fp"/>
</defaultStyles>
</style>
</pageFooter>
<style>
<defaultStyles>
<defaultStyle refStyle="pp"/>
</defaultStyles>
</style>
</page></promptPages></layout>
</layouts>
<classStyles>
<classStyle name="pd_1" label="Excellent">
<CSS value="background-color:#009933; color:#FFFFFF;"/>
</classStyle>
<classStyle name="pd_2" label="Very good">
<CSS value="background-color:#FFFFFF; color:#009933;"/>
</classStyle>
<classStyle name="pd_3" label="Average">
<CSS value="background-color:#FFFFFF; color:#CC9900;"/>
</classStyle>
<classStyle name="pd_4" label="Below average">
<CSS value="background-color:#FFFFFF; color:#990000;"/>
</classStyle>
<classStyle name="pd_5" label="Poor">
<CSS value="background-color:#990000; color:#FFFFFF;"/>
</classStyle>
</classStyles>
<XMLAttributes><XMLAttribute name="RS_CreateExtendedDataItems" value="true" output="no"/><XMLAttribute name="listSeparator" value="," output="no"/></XMLAttributes></report>
Regards
Anil K.Marri
As far I see from you specification you did not do any from the steps that I proposed.
Please try the things that I propose (the corrected ones in my last post) and tell me if it works and if does not where is the problem in order to help you
Hi Pricter
Thank you
I followed as u r steps
but coming error
UDA-EE-0094 The Operation "equal "is invalid for the following combination of data types :"VARCHAR" and "INTEGER"
Regards
Anil K.Marri
Which of the query item gives this error?
Could you provide me with the expression that you use in the query item that cause the problem