XtraReport - get data from non-master datasource based on a parameter value - devexpress

I want to get data from non-master datasource based on a parameter value.
Let's say we have 2 datasources in report:
* datasource1 - main dataprovider
* datasource2 - from which I need to get additional data
And also we have a report parameter, which is bound to the datasource2 to populate dropdown when report is opened.
I need that whenever user picks one of the option from parameter dropdown and submits, to grab corresponding item data from datasource2 and put in the report.
Is it possible? I didn't find any answer on the internet.

it will be possible if you leave single datasource but with two tables/datamembers,
for example DevExpress SqlDataSource may have number of Queries,
in the needed label you may write the expression
iif(Parameters.UseDefault, OptionalTable.DefaultValue, DataTable.ValueColumn)
is this helpful for your scenario?

Related

RDLC - calling a Subreport a variable number of times from a Report

I have a report designed in RDLC that has a Dataset consisting of a set of integer UserID values. The report consists of a one-column table, with each row grouped by UserID. Inside each cell is a subreport generated from the UserID. The subreport is also designed in RDLC from two separate datasets, each of which is generated based on the UserID.
How do I design the subreport to generate the appropriate information for each Parent row's UserID?
I don't see how it can be done on the parent report side, as the method defined in SubreportProcessingEventHandler appears to be called just once, rather than once for each UserID's Subreport.
I assume it has to be done in the Subreport's ascx.cs file - but where would I put it? Is there a predetermined method name to use, or do I call the method from the parent somehow?
Is what I am describing even possible?
Apparently, the answer - at least, the one that works when I do it - is, the SubreportProcessingEventHandler is, in fact, called once for each UserID, so the UserID is passed to the handler as a parameter, and the subreport's data sets are built within the handler using that UserID.

DevExpress XtraReport shows empty DetailReport but correct rowcount

I'm using XtraReports 12.2.12 in my lightswitch project.
This projects connects to a sql database as datasource.
I created a report class and added a query as datasource for the report.
Then added a detailreport with the context menu -> "Insert detail report" to a bound list. (Suggested by xtrareports)
This bound report actually contains the data of a n to n mapping table with references to the corresponding tables. In the detailreport I try to display the data of one of these tables but receive only empty fields.
The funny thing is - the rowcount of empty rows (countable because of the labels I inserted into the report) is correct - only the data is missing.
I thought maybe the xtrareports component is not able to load the data from the referenced table but even the data from the detail report main table is not shown.
Maybe someone could give me a hint on how to solve this.
Thx in Advance
Steve
The solution for this problem was to get rid of the unbound datasource in the report and put every subreport in a separate report class and then insert XRSubReport Control in the main report to include the newly created report, pass parameters and handle BeforePrint events correctly.

Data copied between rows on form's datagrid

Within AX 2009, I have, through compare and compile, added two new controls within a datagrid on a form, a Real edit and a combobox. I have compiled with no issues. The Allow Edit property is set to Yes on both controls.
However, on the form, if I edit one row, whether typing a new number with Real edit or combobox, and don't hit Save but hit the Down Arrow key, the data I typed on the previous records is duplicate in the next record and so on until I release the Down Arrow key, rather than just setting the focus on a new record.
The table where these fields were created doesn't exhibit this behavior. The focus simply moves to the next record and what was typed will not carry over to the next record. Only the form does this...
Has anyone seen this behavior before with AX forms?
You may have omitted to specify the data source on the grid itself?
Or if the new controls are based on Edit methods on the data source, have you got the data source parameter in the method signature?
see http://msdn.microsoft.com/en-us/library/aa637541(AX.10).aspx

Collect all parameters from all reports in reportserver folder and populate a sql table

[Thanks to Filburt and Devjosh. I have restructured the post and included my attempt approach. ]
I have a table on my SQL DB call ReportList which is a list of report. I need to go through that list and interrogate the reportserver, eport by report, to populate a table called ReportParameters. The ReportParameters table has a column for ReportOwnerID which needs to contains the ReportID value of the corresponding (owner) report as listed in the ReportList table.
This is in VB.NET 2005 ASP2.0 and I have ended up with a mess. Please help me with the cleanest approach to doing this.
It needs to work so:- I have a listbox of the reports as per REportList and a GridView that list all the parameters (uniquely - most of the parameters are common to many reports) the idea being that the parameters get set once and the report can be kicked off by selecting them in the ReportList CheckListBox and clicking on Execute.
I would like it that as I click on a particular report in the ListView, the relevant parameters in the Gridview get a green background and those that do not apply are red. The leftmost column in the gridview contains tha Parameter NAME (not editable) and the next column must be editable to populate the value.
DONE SO FAR:
I have tried on clicking the EXECUTE button , to build a parameters string in a testbox and call that with the Javascript OpenReportWin() function when I open the report in a new window. This works fine, but my biggest issue it interrogating the reportserver reports to get back a list of parameters and dooping them into a table. I have triend to use a hidden DataGrid bound to a ds onto the reportParamaters table; I have tried to poulate it using a datalist but I cannot get the hang of these thionsg and its looking messy. Ther must be a simple clean way of gettting the .GetParameters resultset back from the report server and populating the table without having to create a reportviewer object and cycling through the list of reports - it then has to render each report before you can get that list out.
Thanks
I will withdraw this for now. I will submit a solution when I am comfortable that I have reahced a clean solution.
Mac
PLEASE CLOSE!!!

Bind a Text Box to a Field Selected by SQLDataSource (VB.NET)

I'm looking for the easiest way to bind data from a SqlDataSource to textboxes dropped in Visual Studio 2008.
For example, I have 4 textboxes currently that have Address, City, State, Zip. I also have a SqlDataSource on the page fetching the ID of the record and selecting those 4 fields based on ID.
How am I able to quickly bind each box to those particular fields selected? I would think this would be really straight forward - but seems it's not. Seems like the answer is funneled towards having to create a GridView or some type of control.
Be gentle...I'm a nub :)
In general you are correct, if you want to use databinding you'll need to use an appropriate control. For this example I'd suggest using a FormView - it is designed to display the results from a single database record and uses templates, meaning you'll have complete control over the output. This article is probably a good place to start: FormView Control: Step by Step.
To read the values bound to the FormView in the code-behind class you would need to create an event handler for the FormView's DataBound event. In that event handler you would reference the controls programmatically via FindControl, like so:
Dim myLabel As Label = CType(FormViewID.FindControl("id"), Label)
Here, id would be the ID of the Label whose value you were interested in. Once you have a reference to the Label you can get its value using myLabel.Text.

Resources