This is a migrated thread and some comments may be shown as answers.

Exec Function Invalid Scope

3 Answers 758 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
sid
Top achievements
Rank 1
sid asked on 21 Jul 2011, 04:26 PM
Hi,
 I am trying to exec function to refer another datascope. I have a list 'list1' which is bound to sqlDataSource1 and another list in this list 'list2' which is bound to sqlDataSource2, I am trying to refer to a field in datascope of list1 using exec but it is complaining invalid scope list1.
the exec function is used to display the value in the textbox:
=CDbl(Exec("list1", Sum(Fields.Id)))

I am also wondering if i can just refer to Fields.Id, which is what I actually need but for now i am just trying to get the exec function work with typical aggregate function.

Please help, Thank you

3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 22 Jul 2011, 03:00 PM
Hello Sid,

The Exec function executes the specified expression in the given scope of the same data item (report, table, list, crosstab, subreport and chart). In other words if you have report with groups the exec function can execute an expression in the report's detail section with scope the report's group. However you can't use the exec function in the report's detail section to refer a field in another data item (list) or use it one list to execute expression in the scope of another. 

Generally we will appreciate if you elaborate on your scenario that requires a reference to another data item's field.

Greetings,
Peter
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
sid
Top achievements
Rank 1
answered on 22 Jul 2011, 04:01 PM
Let me be clear of what i am trying to acheive,
 I want to display a report which has a List
-- A list of Customers - MainList
- with their name, adress,.. etc
     and 
    -- for each customer I would like to show 
    -- A list of transactions that belong to them -- ChildList   -- Transaction Date, Amount, ....etc

So I thought of acheving this by having two datasets,
 ds1 -- holds a list of all customers
 ds2 -- holds all transactions for all customers

So using these datasets I would assign ds1 to my MainList and using data explorer drag and drop my display firlds

And i will assign ds2 to my ChildList and drop and drop my display fields from my data explorer

But I have to filter my ChildList for that customer, so I would like to get the CustomerId from MainList and assign to the filter of my ChildList

For accessing the CustomerId from MainList I have to access DataScope from MainList, for which I am using exec funtion.
So, Can this be acheived using exec function, or if there is better way to do this, please advise..
Thank you
0
IvanDT
Telerik team
answered on 26 Jul 2011, 04:26 PM
Hello Sid,

You can use our CrossTab in order to generate data in similar way as you showed us in the example. Also we've attached an example with objectDataSource which is with similar data like the one showed in the screen shot. Don't hesitate to contact us if you have other questions.

Kind regards, IvanDT
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
General Discussions
Asked by
sid
Top achievements
Rank 1
Answers by
Peter
Telerik team
sid
Top achievements
Rank 1
IvanDT
Telerik team
Share this question
or