Showing posts with label upon. Show all posts
Showing posts with label upon. Show all posts

Wednesday, March 21, 2012

Displaying traffic lighting images using MDX query

Hi All,

I want to display traffic light images in jpivot table depending upon the measures . I can be able to display color in the jpivot table. How to display images?

Thanks in advance.

Hi Rajha,

you have to create a KPI in your cube.

Edit your cube in BIDS and then go to KPI's tab. Create a new KPI and complete the form with MDX script you need for Value, Goal, Status and Trend. There you can also set Status indicator e Trend indicator (traffic light, gauge, standard arrow and so on).

|||

Hi Francesco,

Thank you very much for your help. I'm a newbie to mdx. Actually I am using some open source database and cube designer which doesnt have KPI property. Can I manually add that code to my mdx query? If so, can u tell me where I can found related documents.

|||

Hi Rajha,

I really don't know if there's a way to obtain the same in MDX but I'm thinking not.

What you can easily do is to color cell depending on the value in it like this:

WITH MEMBER MEASURES.DEMO AS

'[Measures].[Internet Sales Amount]' ,

FORE_COLOR = 'IIF ( MEASURES.DEMO < [Measures].[Reseller Sales Amount] * 0.7,

RGB(0,255,0),

RGB(255,0,0)

)'

SELECT

{MEASURES.DEMO} ON COLUMNS,

NONEMPTYCROSSJOIN([Date].[Calendar].[Month].Members,[Department].[Departments].[Department Level 02].MEMBERS) ON ROWS

FROM [Adventure Works]

CELL PROPERTIES VALUE, FORMATTED_VALUE, FORE_COLOR

At the moment I'm not able to find documentation about this but you can check on the web

Let me know if it's what you're looking for and please check my answer if you think if it was helpful anyway.

P.S. what product are you using that supports MDX?

Francesco

|||

Hi Francesco

Thanks for your reply. As I said in my first thread I can be able to show color depending upon the conditions but i cant bring images in the table.

I'm evaluating Pentaho which uses mdx for drill down reports.

Displaying Totals in matrix-control based upon a RunningValue-expression

Hi,
I have a Matrix-control which has to "summarize" a lot of data in the end,
based upon boolean values. (the column-grouping is a static group).
Customer1
Test1 0 1 0 Value 1
Test 1.1 Value 2
Test 1.2 Value 3
Test 2 1 0 1 Value 4
Test 2.1 Value 5
Test 3 0 1 0 Value 6
______________________________________
Totals: 1 2 1
Customer 2
Test 1 ...
The values are bool-values AND not always displayed. I want to summarize
the values as they appear on the screen, not how they are in the dataset.
Because, now the runningValues-function always summarizes to much, which is
also al the "invisible" data between the main groups. I have written
something to display 0 in the subgroups, but it doesn't change my result.
Is it possible to do this and, if so, how?
Thanks a lot for your answers!
IveAre you giving a Scope'
"Ive" wrote:
> Hi,
> I have a Matrix-control which has to "summarize" a lot of data in the end,
> based upon boolean values. (the column-grouping is a static group).
> Customer1
> Test1 0 1 0 Value 1
> Test 1.1 Value 2
> Test 1.2 Value 3
> Test 2 1 0 1 Value 4
> Test 2.1 Value 5
> Test 3 0 1 0 Value 6
> ______________________________________
> Totals: 1 2 1
> Customer 2
> Test 1 ...
> The values are bool-values AND not always displayed. I want to summarize
> the values as they appear on the screen, not how they are in the dataset.
> Because, now the runningValues-function always summarizes to much, which is
> also al the "invisible" data between the main groups. I have written
> something to display 0 in the subgroups, but it doesn't change my result.
> Is it possible to do this and, if so, how?
> Thanks a lot for your answers!
> Ive
>
>|||Yes,
I am!
Problem is that the Scope doesn't seem to work correctly: it refers to the
dataset in stead of the matrix itself.
I have tried something like this:
=RunningValue(Abs(cInt(Fields!PlannedChecked.Value)),Sum,"matrix1_SubGroup")
I again refer to the fact that Fields!PlannedChecked.Value is a boolean
value and that he doesn't seem to summarize the values as in the control,
but in the dataset. He doesn't summarize correctly.
The runningValue function was inserted with an IIF -statement in combination
with the InScope-function to determine whether I'm actually in a
summarize-column.
A count would also do the job, but how to do that if I can't put a
limitation on the scope?
A dSum would do the trick, but that isn't supported.
I'm really stuck on this one, but as long as someone hasn't officially told
me how the RunningValue-function works exactly in a matrix-control, I keep
searching for a solution and reason.
Regards,
Ive
"Soan" <Soan@.discussions.microsoft.com> wrote in message
news:EF2FBEA3-C751-4C63-84C5-C319251D5F7C@.microsoft.com...
> Are you giving a Scope'
> "Ive" wrote:
>> Hi,
>> I have a Matrix-control which has to "summarize" a lot of data in the
>> end,
>> based upon boolean values. (the column-grouping is a static group).
>> Customer1
>> Test1 0 1 0 Value 1
>> Test 1.1 Value 2
>> Test 1.2 Value 3
>> Test 2 1 0 1 Value 4
>> Test 2.1 Value 5
>> Test 3 0 1 0 Value 6
>> ______________________________________
>> Totals: 1 2 1
>> Customer 2
>> Test 1 ...
>> The values are bool-values AND not always displayed. I want to summarize
>> the values as they appear on the screen, not how they are in the dataset.
>> Because, now the runningValues-function always summarizes to much, which
>> is
>> also al the "invisible" data between the main groups. I have written
>> something to display 0 in the subgroups, but it doesn't change my result.
>> Is it possible to do this and, if so, how?
>> Thanks a lot for your answers!
>> Ive
>>

Sunday, February 19, 2012

Display of message on page footer depending on field value

Hi
My requirement is like this, i need to display message on footer(table
footer ) depending upon the value of one of field column (LegendInd ,the
value will be 1 for legend and null for no legend)which varies for rows.I
want message at footer.I tried like this. I have table in which i display
field data.In that i added table footer and in table footer i added following
expression. =iif((Fields!LegendInd.Value =1),"my message","").Despite of
having the value 1 for this field , the message never gets printed.
Any suggestions?try putting =Fields!LegendInd.Value in the footer and see what it prints.
Also you could try =First(Fields!LegendInd.Value)
If that prints fine then your message should print
"Aniruddha" wrote:
> Hi
> My requirement is like this, i need to display message on footer(table
> footer ) depending upon the value of one of field column (LegendInd ,the
> value will be 1 for legend and null for no legend)which varies for rows.I
> want message at footer.I tried like this. I have table in which i display
> field data.In that i added table footer and in table footer i added following
> expression. =iif((Fields!LegendInd.Value =1),"my message","").Despite of
> having the value 1 for this field , the message never gets printed.
> Any suggestions?|||Thanks for reply Ram
i tried both approaches,but still it is not displaying the value.
I checked from database side,it does bring LegendInd=1 value.
"vRam" wrote:
> try putting =Fields!LegendInd.Value in the footer and see what it prints.
> Also you could try =First(Fields!LegendInd.Value)
> If that prints fine then your message should print
> "Aniruddha" wrote:
> > Hi
> > My requirement is like this, i need to display message on footer(table
> > footer ) depending upon the value of one of field column (LegendInd ,the
> > value will be 1 for legend and null for no legend)which varies for rows.I
> > want message at footer.I tried like this. I have table in which i display
> > field data.In that i added table footer and in table footer i added following
> > expression. =iif((Fields!LegendInd.Value =1),"my message","").Despite of
> > having the value 1 for this field , the message never gets printed.
> > Any suggestions?

Tuesday, February 14, 2012

Display DB Records In Label?

A SQL Server 2005 stored procedure expects a parameterUserID depending upon which it retrieves the no. of records & OrderIDs corresponding to theUserID from a DB table (note thatOrderID &UserID are two of the columns in the DB table). So for e.g. consider a user whoseUserID=6 & the DB table has 3 records whereUserID=6. In other words, there are 3OrderID records of the user whoseUserID=6, say,OrderID=8,OrderID=17 &OrderID=29. The stored procedure will finally return 2 columns - the OrderCount (which is 3 forUserID=6) & the OrderID (which will be 8, 17 & 29 forUserID=6). This is the stored procedure:

ALTER PROCEDURE dbo.OrderCount
@.UserID int
AS
DECLARE
@.OrderCount int

SET @.OrderCount = (SELECT COUNT(OrderID) FROM NETOrders WHERE UserID= @.UserID)

SELECT @.OrderCount AS OrderCount, OrderID
FROM
NETOrders
WHERE
UserID = @.UserID

In a VB class file, I am invoking the stored procedure in a function namedGetOrderCount which returns aSqlDataReader back to the calling ASPX page. I want the ASPX page to display the 3 OrderIDs ofUserID=6 in aLabel control. Unlike the DataBinding controls likeDataList,DataGrid,Repeater controls, theLabel control will not automatically loop through the recordset.

So I tried to accomplish this using aFor...Next loop

Dim i As Integer
Dim sqlReader As SqlDataReader

iUserID = Request.Cookies("UserID").Value
'ShopCart is the name of the class in the VB class file
boShopCart = New ShopCart
sqlReader = boShopCart.GetOrderCount(iUserID)

While (sqlReader.Read)
If (sqlReader.GetValue(0) > 1) Then
pnlLinks.Visible = True
For i = 1 To sqlReader.GetValue(0)
lblLinks.Text = sqlReader.GetValue(1)(i)
Next i
Else
pnlLinks.Visible = False
End If
End While

But this generates the following error:

No default member found for type 'Integer'.

pointing to the line

lblLinks.Text = sqlReader.GetValue(1)(i)

in the above shown ASPX code. Can someone please correct me & suggest how do I loop through the recordset so that I can display the records in aLabel control?

Hi,

Replace these lines:
For i = 1 To sqlReader.GetValue(0)
lblLinks.Text = sqlReader.GetValue(1)(i)
Next i

with this line where your column id is 1:
lblLinks.Text &= sqlReader.GetValue(1)

|||

RN5A:

A SQL Server 2005 stored procedure expects a parameterUserID depending upon which it retrieves the no. of records & OrderIDs corresponding to theUserID from a DB table (note thatOrderID &UserID are two of the columns in the DB table). So for e.g. consider a user whoseUserID=6 & the DB table has 3 records whereUserID=6. In other words, there are 3OrderID records of the user whoseUserID=6, say,OrderID=8,OrderID=17 &OrderID=29. The stored procedure will finally return 2 columns - the OrderCount (which is 3 forUserID=6) & the OrderID (which will be 8, 17 & 29 forUserID=6). This is the stored procedure:

ALTER PROCEDURE dbo.OrderCount
@.UserID int
AS
DECLARE
@.OrderCount int

SET @.OrderCount = (SELECT COUNT(OrderID) FROM NETOrders WHERE UserID= @.UserID)

SELECT @.OrderCount AS OrderCount, OrderID
FROM
NETOrders
WHERE
UserID = @.UserID

Dim i As Integer
Dim sqlReader As SqlDataReader

iUserID = Request.Cookies("UserID").Value
'ShopCart is the name of the class in the VB class file
boShopCart = New ShopCart
sqlReader = boShopCart.GetOrderCount(iUserID)

While (sqlReader.Read)
If (sqlReader.GetValue(0) > 1) Then
pnlLinks.Visible = True
For i = 1 To sqlReader.GetValue(0)
lblLinks.Text = sqlReader.GetValue(1)(i)
Next i
Else
pnlLinks.Visible = False
End If
End While

If I understand your issue correctly, the stored procedure will return several rows with 2 columns--the first column is identical for all rows, and the number of returned rows (let's say N) is determined by the qualified records, so there are N OrderIDs. Then when using SqlDataReader, you only need a single loop to go through all records, no matter what's the value of OrderCount; and you can just use SqlDataReader.GetValue(1) to access the OrderID field in each returned row, not SqlDataReader.GetValue(1)(i). So the OrderCount column seems to be redundant in this case.

|||Well mates......I am sorry to say that I forgot to mention one very important point in post #1. I want to display the 3OrderIDs ofUserID=6 in theLabel control but theText of theLabel should not be theOrderIDs themselves. In other words, theLabel should not display

8 17 29

which are the 3OrderIDs ofUserID=6. Rather theText of theLabel, which will reflect how many orders a user has placed, should start from 1 & increment by 1 till the total number of orders a user has placed. For e.g. sinceUserID=6 has 3OrderIDs, it means thatUserID=6 has placed 3 orders - theOrderID of the first order being 8, theOrderID of the second order being 17 & theOrderID of the third order being 29. Hence theLabel control should display

1 2 3

toUserID=6 since he has placed 3 orders. Similarly, if a user has placed, say, 8 orders, theLabel should display

1 2 3 4 5 6 7 8

& not theOrderIDs of the 8 orders. That's precisely the reason why I used theFor..Next loop in the code shown in post #1 but the problem is since theFor..Next loop has to be within aWhile loop to read theSqlDataReader something like this:

While (sqlReader.Read)
For i = 1 To sqlReader.GetValue(0)
lblLinks.Text += i & " "
Next
End While

theLabel control displays the value ofi more than once since its looping inside a loop. So forUserID=6, theLabel control displays the followingText:

1 2 3 1 2 3 1 2 3

Any idea how do I resolve this problem or any other suggestiona?|||

Hi,

You can try doing this:
Declare a counter variable before your while loop
dim counter as integer = 1


Replace these lines:
For i = 1 To sqlReader.GetValue(0)
lblLinks.Text += i & " "
Next

with these line
lblLinks.Text &= counter & " "
counter++

|||Thanks a lot, Anjin....that's exactly what I was looking out for. It was really stupid of me to ask the follow-up question which you answered. I should have done that myself but the day I was working on it, it was one of those days when the brain just refuses to work!!|||

hi,

not to argue with, though your code will work fine but still better would be to user stringbuilder and append text to it rather using string i.e. lbl.text +="";

like

StringBuilder sb = new StringBuilder();

sb.append(whatever you like);

appending to stringbuilder has performance advantage.

regards,

satish

|||Thanks, Satish, for the alternative but simply using

sb.Append(i)

won't display anything on the ASPX page for the users to view. To display the output produced by using theAppend method of theStringBuilderclass, something like

lblLinks.Text += sb.Append(i)

has to be used, isn't it? So why unnecessarily useStringBuilder as shown in the preceding line when the following line will generate exactly the same output?

lblLinks.Text += i

So I doubt whether using StringBuilder (atleast in my case) will indeed have any performance advantage. Correct me if I am wrong.|||

errrr

sorry mate

first you keep appending the text/values etc in stringbuilder in loop or whatever, then after loop finishes use

lable.text = sb.ToString();

regards,

satish