Subreport in RDLC file - visual-studio-2010

I have one problem in generating Reports in VS2010. I am using RDLC. My task is to generate a report where it should show customer details like Name, Contact number, Email Id etc in the top portion of the report.
In the body section it should show the list reservation details.
My object structure is as follows:
CustomerDetails:
Name
Age
ContactNumber
Email Id
List<ReservationDetails>
ReservationDetails
FromDate
ToDate
Period
Amount
I do not know how to render the List in subreport. It is not dynamic and I got all the details in initial load itself.
I split the report into tow section, First (parent) is to show the common details. and Subreport is to show the list of Reservation details.

1- Create your Main report that show the customer details as you reauired by passing dataset "Customers"
2- Add a new Report "rptCustomerReservation"
3- Add dataset that returns List by taking a parameter CustomerID
4- In main report , select a cell where you want to add a report, insert -> Sub report
5- Go to Sub Report properties add rptCustomerReservation in name and use report as sub report fields.
6- Select File rptCustomerReservation, in Report data window,right click on Add Prameter, Click Add parameter. Give type ineger. and give name.
7- Go in to main report and right click sub report,go to properties, click parameters tab, give same parameter name and select parameter value from dataset dropdown.
8- Add following code in cs file to register and event to add sub report in page load.
public Ctor()
{
rptViewer.LocalReport.SubreportProcessing += LocalReport_SubreportProcessing);
}
void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
List<CATALOG_ITEM_DETAIL> DTCatalogItemDetail;
if (e.ReportPath == "CatalogItemListItemDetails")
{
DTCatalogItemDetail = report.GetCatalogItemDetail(Convert.ToInt32(e.Parameters[0].Values[0]));
ReportDataSource ds = new ReportDataSource("dsItemDetails", DTCatalogItemDetail);
e.DataSources.Add(ds);
}
}

Related

Setting date value in an Interactive grid based on a page item

I am trying to set a interactive grid column value (which is a date) based on a page item (which is also a date). I have already tried defaulting and using dynamic action set value (jquery seletor) to set item value to the interactive grid column but it does not work how I want it to work.
I have a page item called "P_DEF_DATE" and I want to set a date column in the interactive grid to this value but I want when I change the value in the page item and I click add row on the interactive grid, it must always use whatever value I have in the page item. For example:
P_DEF_DATE = 12-JAN-2021
when I click on add row in the interactive grid, my date column must equal to P_DEF_DATE and i add a few rows based on that date but then i change the date of P_DEF_DATE to:
P_DEF_DATE = 28-JAN-2021
now I want when I click on add row in the interactive grid, I it must show this new date from the page item in the date column in the interactive grid, keeping in mind the page does not refresh and I have rows with the date 12-JAN-2021.
Thank you in advance!
I implemented same few days ago. Following is what I did.
Create Dynamic Action on Row Initialization Event, set Region to your IG
Set True Action to Execute JavaScript Code
Use code
var model = this.data.model,
rec = this.data.record,
meta = model.getRecordMetadata(this.data.recordId);
if ( meta.inserted ) {
model.setValue(rec,"COLUMN_NAME", $v("P_DEF_DATE"));
}
Replace JOB with your column name and P_DEF_DATE with you Item name
More details Here
Also, out of curiosity, why there is no number like P1, P2 in your item name ??

Tableau: How to restrict a dropdown filter to fields that start with "2021*" (a fiscal week field that adds a new field weekly)?

I need an automatic way to have new fiscal weeks (a string that looks like yyyyww) added to my dropdown filter. It's necessary that it's a dropdown unfortunately. Can I just filter out all values that don't start with "2021*" in this particular table? I use those other values in other parts of my dashboard, so I can't filter them out of my data completely.
Create a calculation called DateDisplay as follows:
IF STARTSWITH((STR([Period])),'2021') = TRUE then 'Display'
END
Add the new DateDisplay field to the Filters Shelf and uncheck NULL
Select 'Show Filter' for the string date field
On the drop down menu (down arrow on the right) for the filter which is now showing, select the options 'Only Relevant Values'

making my tabular form dynamic

I have a checkbox on a tabular form. I need to be able to hide it if the submit date is not filled in and show it when a date is there. Once the checkbox has been clicked, I need to update another field based on the checkbox being clicked or when I hit the update button. is this possible on a Oracle Apex tabular form in version 4.2?
You can create dynamic actions on tabular form fields, but you need to know some Javascript / jQuery / DOM stuff as it can't be done declaratively as it can with page items.
As an example, I created a simple tabular form on the EMP table:
Using the browser's Inspect Element tool I can see that the HTML for the Ename field on row 3 looks like this:
<input type="text" name="f03" size="12" maxlength="2000" value="Ben Dev"
class="u-TF-item u-TF-item--text " id="f03_0003" autocomplete="off">
The relevant bits to note are the name "f03" and the ID "f03_0003". For all tabular form fields, the name indicates the column, and is the same for all fields in that column. The ID is made up of the name plus a string to represent the row - in this case "_0003" to represent row 3.
Similarly, the Hiredate fields are all named "f004" and have IDs like "f04_0003".
Armed with this information we can write a dynamic action. For example, let's say that whenever Ename is empty then Hiredate should be hidden, otherwise shown. In pseudo-code:
whenever an element with name "f03" is changed, the element with name "f04" on the same row should be hidden or shown.
So we can create a synamic action with a When condition like this:
Event = Change
Selection type = jQuery selector
jQuery selector = input[name="f03"]
i.e. whenever an input whose name is "f03" is changed, fire this action.
The action performed will have to be "Execute Javascript code", and the code could be:
// Get the ID of this item e.g. f03_0004
var this_id = $(this.triggeringElement).attr('id');
// Derive the ID of the corresponding Hiredate item e.g. f04_0004
var that_id = 'f04'+this_id.substr(3);
if ($(this.triggeringElement).val() == "") {
// Ename is empty so hide Hiredate
$('#'+that_id).closest('span').hide();
} else {
// Ename is not empty so show Hiredate
$('#'+that_id).closest('span').show();
}
Because Hiredate is a date picker, I needed to hide/show both the field itself and its date picker icon. I chose to do this by hiding/showing the span that contains them both. This code could have been written in many different ways.
You could apply similar techniques to achieve your aims, but as you can see it isn't trivially easy.

Populating DataGrid in Visual Studio from Access Database?

I have a datagrid in my form. What I did was I made an OleDb connection to my database in access, then I made a dataset in my project and put my Food table in that. Then on the page that contains the form, I added a dataset (dataset11) from the Data Toolbox that links to dataset1.xsd in my project. I then put the data source on my datagrid to dataset11.Food (Food being the table I want to display). This adds the two fields in that table to the datagrid (id and size) but none of the data I put in in access shows up! There are 15 entries in this table but they don't show up on my datagrid even when I run the program. What am I doing wrong???!?!!?!?!?
Here is a picture: http://i39.tinypic.com/2rr43yf.png
Edit added code from external link
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("Tag", Me.Dataset11, "Food.Size"))
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("DataSource", Me.Dataset11, "Profile.ProfileName"))
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("DataMember", Me.Dataset11, "Profile.ProfileName"))
Me.DataGrid1.DataBindings.Add(New System.Windows.Forms.Binding("Visible", Me.Dataset11, "Profile.ProfileName"))
Me.DataGrid1.DataMember = ""
Me.DataGrid1.DataSource = Me.Dataset11.Profile
Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGrid1.Location = New System.Drawing.Point(296, 8)
Me.DataGrid1.Name = "DataGrid1"
Me.DataGrid1.Size = New System.Drawing.Size(384, 256)
Me.DataGrid1.TabIndex = 12

how to code the itemchanged event and datawindows

I am using PowerBuilder classic 12.5
am having difficulties in inserting, editing, creating and printing reports.
i have a datawindow, dw_NewEmployee with dataobject, d_newrecord which is update-able.
should i use the columns to insert records through the columns or i
create single line texts on the window object
is the itemchanged event used on columns and rows on dataobject or
on single line texts... I am having trouble figuring out how to implement validation rules.
please give me an example to validate employee ID_Number
I see that you seem confused about the datawindow usage.
Let's try to summarize:
you create a new datawindow d_newrecord (say it is a grid) based on a sql select in your database, say select id_number, name from employee.
in the detail zone of the datawindow (that will be repeated for each record at runtime but that is only once in design), you need to put one column object for each column (here you will have id_number and name) these objects are both to display existing data and receive user input for editing data and inserting new records.
don't forget to set the Rows / Update properties if you need to make the dw updatable.
in the header zone of the datawindow you can have a static text associated to each column that is just here to display the column name, it does not concern table data.
in some window object, you place a datawindow control dw_newemployee where the content of the datawindow will be painted, you set d_newrecord as its dataobject.
you need to set at some point the transaction object of the dw, for example in the open() event of the window:
dw_newemployee.SetTransObject(sqlca)
dw_newemployee.Retreive() //if you are using some retreival arguments, don't forget to include them here
When you want to insert new data in your table (for example with a window button "add"), in the clicked() event of the button you call dw_newemployee.InsertRow(0) to insert at the end.
The ItemChanged() event will be triggered after one cell will be modified, you will be given the row, item (a dwobject) and new data. By choosing the returned value of the event, you can accept or reject the new data.
Here is an example for a field validation in itemchanged() event:
long ll_return_code = 0
string ls_column
ls_column = lower(dwo.name)
choose case ls_column
case "id_number"
if long(data) = 42 THEN
messagebox("validation error", "You cannot use 42 for the ID")
ll_return_code = 1 //reject and stay in cell
end if
case "name"
if data = "foobar" then
messagebox("validation error", "Do not use dummy value...")
ll_return_code = 2 //reject but allow to go elsewhere
end if
end choose
return ll_return_code

Resources