Eliminate Group Footer Page Break Before Report Footer - reporting

I have a report with a group header and footer. There should be only two groups based on the data. I have the Group Footer set to have a page break after it. I don't want the last Group to create a page break before the Report Footer (If I did, I would set the report footer to have a page break before it.). I've never had this problem with other report writers.
Example of what the report printout looks like and not the design. My report only has one group header and one group footer:
Report Header
Group Data Set 1 Header
detail
detail
detail
Group Data Set 1 Footer
Group Data Set 2 Header
Detail
Detail
GroupData Set 2 Footer
! I don't want this!
Report Footer (stuck on last page by itself)
Posted on their board: http://community.devexpress.com/forums/t/78705.aspx

This determines when you've reached the end of the report and stops the group footer from breaking the page. It assumes that your group footer's PageBreak property is already set to PageBreak.AfterBand.
private void Report_DataSourceRowChanged(object sender, DataSourceRowEventArgs e) {
if (e.CurrentRow == this.RowCount - 1)
GroupFooter.PageBreak = PageBreak.None;
}
Alternatively, you could set both your group header and footer's PageBreak property to PageBreak.None. Then when you're printing the first group, set it to page break before each group header band like so:
private void GroupFooter_BeforePrint(object sender, DataSourceRowEventArgs e) {
if (GroupHeader.PageBreak == PageBreak.None)
GroupHeader.PageBreak = PageBreak.BeforeBand;
}
It's up to you which method to choose. Personally I like the 2nd one better. Even though I arbitrarily picked the GroupFooter_BeforePrint method to subscribe and make this change, I would still feel more comfortable doing that than relying on row counts to determine when you've reached the end of the report.

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 ??

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.

Display "No Data" message when table is empty in BIRT Report

I want to hide a table and to report that "No Data" message is present if the query returns no data.
In computed columns i have added the columns which counts the number of rows present(i.e.TableCheck).
and i have created label just below the table with the message "No Data". In script onCreate i have added the below code.
if( countOfRows == 0 ){
this.getStyle().fontStyle = "italic";
this.getStyle().fontSize = "large";
}else{
this.text = "";
}
countOfRows = 0 is initialize in script.
In table visibilty propery, checked the Hide Element and added the below code in expression.
if (row["TableCheck"] == null){
true
}
else{
false
}
Problem: When dataSet is empty "No Data" Message is displaying.But when data set is not empty, then error message is not hiding.
Please let me know how to fix this.
Thanks in Advance.
Do it this way:
First add visual elements to display it when data set doesn't return any row.
Then define global variable in Initialize script of report root.
For example
rowsReturned = 0;
On your table that you'll evaluate data set to see is there rows returned on Visibility tab set next:
On elements you want to display whene there is no returned data set this on Visibility tab
If you want to hide the table when no data returned, you can write this in its Visibility property:
row.__rownum < 0
and in Visibility property of your "No Data" message you use the opposite check:
row.__rownum >= 0
Note that both components must be bound to the data set you want to check. In the case of the message component you can achieve this putting it in a header or footer row.
Alternative solution without using global variables (though functionally not quite the same, because the layout will always contain a table):
Add a binding numRows for the COUNT aggregate with the expression 1 to the table.
Set as visibility expression on the table header row:
!row["numRows"]
Add a new footer row to the table; for this footer row set the visibility expression
row["numRows"]
Merge the cells in this footer row, then place a label "No data found" into the table cell.

Subreport in RDLC file

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);
}
}

How to mitigate users adding blank rows to a Google Spreadsheet and thus breaking ListFeed API?

We use Google Spreadsheets to collect research data and allow users to directly enter data into spreadsheets that have been pragmatically generated. This has been working fairly well until a user enters a blank line in between data rows! They may do this for readability or they may have deleted a row, anyway...
Google's documentation is clear on this:
https://developers.google.com/google-apps/spreadsheets/#retrieving_a_list-based_feed
The list feed contains all rows after the first row up to the first blank row.
So the problem is that I have 'harvester' scripts that rip through these spreadsheets, collecting up data for archival / local databasing. These scripts use the ListFeed, so they stop when reach a blank row and miss data!
The documentation suggests:
If expected data isn't appearing in a feed, check the worksheet manually to see whether there's an unexpected blank row in the middle of the data.
Manually! Gasp, I have hundreds of sheets :) Do you have suggestions for mitigating this situation other than yelling at users whenever I see this happen! Thank you
This is the only way that I think we can even get close with the spreadsheet API. This is NOT complete code, it's within a function I wrote but you get the drift... it's in C#:
Working with example:
--row 1 = header row
--row 2 = data
--row 3 = data
--row 4 = totally blank
--row 5 = data
--row 6-100 = totally blank
In English:
Get the worksheet's ListFeed.Entries.Count. ListFeeds ignore header row so in this example count would be "2".
Get the worksheet's CellFeed in order to cycle through the cells. CellFeeds DO include the header row as row 1, so in the example, from the perspective of a CellFeed, the first blank row must be row 4 (header=1, then 2 data rows, then first blank line which terminates the ListFeed set), therefore we should begin looking through cells at row 5 and beyond for any cell that is NOT empty:
foreach (WorksheetEntry entry in wsFeed.Entries)
{
//Get the worksheet CellFeed:
CellQuery cellQuery = new CellQuery(entry.CellFeedLink);
CellFeed cellFeed = service.Query(cellQuery);
//Get the worksheet ListFeed to compare with the CellFeed:
AtomLink listFeedLink = entry.Links.FindService(
GDataSpreadsheetsNameTable.ListRel, null
);
ListQuery listQuery = new ListQuery(listFeedLink.HRef.ToString());
//need to have service object already created for this... see API docs
ListFeed listFeed = service.Query(listQuery);
//Now to check if there is data after the ListFeed
//set which would indicate a blank line in the data set (not allowed)
foreach (CellEntry cell in cellFeed.Entries)
{
//start looking in cells in the row after what would be the first blank row
if (cell.Row > listFeed.Entries.Count + 2)
{
if (cell.Value != "")
{
MessageBox.Show("ERROR: There appears to be a blank row +
in the middle of the data set in worksheet: " +
entry.Title.Text + ". Completely blank rows " +
"are not allowed in between data rows. Each row " +
"within the data set must have at least one " +
"value in at least one cell. There CAN and " +
"should be blank rows after the data set at " +
"the bottom of the worksheet.");
return false;
}
}
}
}

Resources