Showing posts with label expression. Show all posts
Showing posts with label expression. Show all posts

Wednesday, March 28, 2012

How to get the return/execution value of a package from a parent?

Hi there,

I'm trying to get the return value of a package. I see there is a ForcedExecutionValue property which I set using an expression (variable). What I'm executing are 2 packages, Package1 contains an Execute Package Task that calls Package 2. Package 2 contains a Script Task that sets the value of variable Max. I want to get the value of Max in Package 1 then how can I do this?

My first approach is toset the return value of Package 2 = Max and then I thought I could retrieve this value from Package 1 but I'm not able to do that yet.

Any thoughts?

Thanks for any help!The way I would approach this is to use a Script Task (surprise, surprise) to load and execute the package instead of the Execute Package Task. Your script has the ability to read the child packages variables after it has executed, thus allowing child variables to be passed back to the parent.
http://blogs.msdn.com/jamesk/archive/2005/12/21/506463.aspx

Alternatively, you can also have the child package set the parent's variable directly.
http://blogs.conchango.com/jamiethomson/archive/2005/03/17/1151.aspx|||Hi JayH,

Yes, I did the first approach and it worked fine. I'm loading the package from a Script Task and getting the Executables.Count and store this value in a local variable.

Thanks for the suggestion!.

Ricardo

Monday, March 26, 2012

How to get the percentage presentation of a returned value in MDX expression for my KPI Definiti

Hi, All,

How can we get the percentage presentation of a value (e.g. a/b, I want to get the result presented in percentage format). How can we achieve this in MDX?

Thanks a lot and I am looking forward to hearing from you shortly.

With best regardsd,

Yours sincerely,

Hi, experts,

Please help me out!

Thanks.

With kind regards,

Yours sincerely,

|||

Hi Helen

You need to create a calculated measure and then use Format_STRING:

Code Snippet

WITH

MEMBER [Measures].[yourMeasure] as

([Measures].[A] / [Measures].[B]),

Format_string="0.000%"

SELECT

[Measures].[yourMeasure]

ON COLUMNS

FROM

[Your Cube]

Hope this helps

Tim

|||

Hi, Tim,

Thanks a lot for your suggestion.

It works perfect.

With kindest regards,

Yours sincerely,

Wednesday, March 21, 2012

How to get the current member in a MDX expression?

Hi, all experts here,

Thank you very much for your kind attention.

I want to know how to get the current member in a MDX expression? (e.g, we want to get the current value'2006' for the time dimension, how can we accompalish this task?)

Hope my question is clear.

With best regards,

Yours sincerely,

There is a function called CurrentMember, but you need to ask for the current member for a given hierarchy or attribute.

eg

[Date].[Calendar].CurrentMember

If you are just after the name of the current member (as in '2006') then you would do something like the following

[Date].[Calendar].CurrentMember.Name|||

Thanks a lot.

Best regards,

How to get the application directory

I need to get the application directory from report server. I wrote System.AppDomain.CurrentDomain().BaseDirectory() in the expression. It works when I click preview in IDE. But it doesn't work when I deploy on the server. How come?

Because BaseDirectory requires CAS FileIOPermission. Try creating an utility assembly and registering it in rssrvpolicy.config. You may need to assert FileIOPermission as well.

sql

Monday, March 12, 2012

How to get result of Expression which builds dynamically?

I am using SQL Server 2000 and in SP or Function, my problem is as follows:
I have one expression in variable of varchar. I want result of that
expression into another variable which is of numeric. For that code look
likes:
--code is as follows--
--Declaration of variables
declare @.str1 varchar (100)
declare @.int1 numeric (18, 2)
--This is assignment is for sampling purpose
select @.str1 = '2 + 2 * 8 / 3'
--Below sentence is my problem, I do not know the way of getting result of
expression in this situation
select @.int1 = cast(@.str1 as numeric)
--I need this value of variable for further use
select @.int1
--code ends here--
I will be thankful if problem get solved. Please note there are lots of code
before building expression and after getting result of this. I stuck up at
this point, as not able to convert string expression to numeric and hence
result.
Thank you in advance.Hi
You could do something like:
--code is as follows--
--Declaration of variables
DECLARE @.str1 varchar (100)
DECLARE @.int1 numeric (18, 2)
CREATE TABLE #tmp ( int1 numeric (18, 2) )
--This is assignment is for sampling purpose
SET @.str1 = 'SELECT (2 + (2 * 8)) / 3'
INSERT INTO #tmp ( int1 )
EXEC ( @.str1 )
SELECT @.int1 = int1 FROM #tmp
SELECT @.int1
DROP TABLE #tmp
But it would probably not be a very scallable solution.
John
"Kaushik Gadani" wrote:

> I am using SQL Server 2000 and in SP or Function, my problem is as follows
:
> I have one expression in variable of varchar. I want result of that
> expression into another variable which is of numeric. For that code look
> likes:
> --code is as follows--
> --Declaration of variables
> declare @.str1 varchar (100)
> declare @.int1 numeric (18, 2)
> --This is assignment is for sampling purpose
> select @.str1 = '2 + 2 * 8 / 3'
> --Below sentence is my problem, I do not know the way of getting result of
> expression in this situation
> select @.int1 = cast(@.str1 as numeric)
> --I need this value of variable for further use
> select @.int1
> --code ends here--
> I will be thankful if problem get solved. Please note there are lots of co
de
> before building expression and after getting result of this. I stuck up at
> this point, as not able to convert string expression to numeric and hence
> result.
> Thank you in advance.

How to get result of Expression which builds dynamically?

I am using SQL Server 2000 and in SP or Function, my problem is as follows:
I have one expression in variable of varchar. I want result of that
expression into another variable which is of numeric. For that code look
likes:
--code is as follows--
--Declaration of variables
declare @.str1 varchar (100)
declare @.int1 numeric (18, 2)
--This is assignment is for sampling purpose
select @.str1 = '2 + 2 * 8 / 3'
--Below sentence is my problem, I do not know the way of getting result of
expression in this situation
select @.int1 = cast(@.str1 as numeric)
--I need this value of variable for further use
select @.int1
--code ends here--
I will be thankful if problem get solved. Please note there are lots of code
before building expression and after getting result of this. I stuck up at
this point, as not able to convert string expression to numeric and hence
result.
Thank you in advance.Hi
You could do something like:
--code is as follows--
--Declaration of variables
DECLARE @.str1 varchar (100)
DECLARE @.int1 numeric (18, 2)
CREATE TABLE #tmp ( int1 numeric (18, 2) )
--This is assignment is for sampling purpose
SET @.str1 = 'SELECT (2 + (2 * 8)) / 3'
INSERT INTO #tmp ( int1 )
EXEC ( @.str1 )
SELECT @.int1 = int1 FROM #tmp
SELECT @.int1
DROP TABLE #tmp
But it would probably not be a very scallable solution.
John
"Kaushik Gadani" wrote:
> I am using SQL Server 2000 and in SP or Function, my problem is as follows:
> I have one expression in variable of varchar. I want result of that
> expression into another variable which is of numeric. For that code look
> likes:
> --code is as follows--
> --Declaration of variables
> declare @.str1 varchar (100)
> declare @.int1 numeric (18, 2)
> --This is assignment is for sampling purpose
> select @.str1 = '2 + 2 * 8 / 3'
> --Below sentence is my problem, I do not know the way of getting result of
> expression in this situation
> select @.int1 = cast(@.str1 as numeric)
> --I need this value of variable for further use
> select @.int1
> --code ends here--
> I will be thankful if problem get solved. Please note there are lots of code
> before building expression and after getting result of this. I stuck up at
> this point, as not able to convert string expression to numeric and hence
> result.
> Thank you in advance.