result on ordering data is not as I expected - forms

I've tried this to sort result on form submit based on cells value (progressive numbers)
function ordina() {
SpreadsheetApp.getActiveSpreadsheet().getSheets()[0].
sort(4,false).sort(8,false).sort(7,false);
}
it almost works but result are not in the correct sequence (01--> 03 --> 02.. instead of 01-->02-->03..)
what I'm missing??!

See this page of support: https://support.google.com/docs/thread/16556745/google-spreadsheet-script-how-to-sort-a-range-of-data
When you chain multiple sort() on the same sheet, the final sort has the highest importance.
So if what you want to achieve is "sort by column C then by column B then by column A" this results to sheet.sort(3).sort(2).sort(1) in Apps Script
If you need more help, please edit your post and show us how the sheet looks like after your sort.

Related

yadcf autocomplete not working as in original examples

In the older examples of the AutoComplete filter, as soon as you typed in a letter the filtering was applied reducing the numbers of rows shown. For example, if I typed the letter "x", only rows with that column containing the letter "x" would be displayed.
{ column_number : 1, filter_type: "auto_complete" },
In the newer examples, the AutoComplete filter does not do this. I want the original functionality for my web page - how do I achieve this? Is there an option I need to pass to the AutoComplete plugin via the filter_plugin_options parameter? Or is there a different filter I should be using?
I can't recall that aytocomplete ever worked this way, you need to use the filter_type: 'text' instead, see the fourth column in the following showcase page
IMO triggering the filter on each keyboard type fits better the text filter rather then autocomplete

Google Sheets converting dates to numbers

I've run into a problem and haven't been able to find a solution for this via Google.
Using Google Sheets, I have a series of dates in the DD/MM/YYYY format in a column, and I'm filtering them based on info in another column with this formula in column G:
=ARRAYFORMULA(FILTER(D:D, B:B=B2))
where the dates are in column D. For example, 5/20/2013.
This works fine, but next, I want to add a string to the front of the dates like so:
=ARRAYFORMULA("End: "&FILTER(D:D, B:B=B2))
The dates are converting into numbers. So 5/20/2013 becomes End: 41414 instead of End: 5/20/2013, which is what I need.
Further, this happens whenever I try to reference a cell with a date in it in any formula. I have another column that puts together some values from other columns like this:
=IF(B:B=B2,ARRAYFORMULA(F2&" "&E2),"")
I want to add the date to that, like so:
=IF(B:B=B2,ARRAYFORMULA(F2&" "&E2&" "&G2),"")
The result I'm getting is the same, where I should see 5/20/2013 I'm instead getting 41414.
Can anyone tell me what's going on and how I can prevent it from converting my dates to numbers like that? Thanks!
In addition to Chris' answer: just converting to text should also work:
=ARRAYFORMULA("End: "&FILTER(to_text(D:D), B:B=B2))
You can format the formula output using TEXT, for example:
=ARRAYFORMULA("End: "&FILTER(TEXT(D:D,"mm/dd/yyyy"), B:B=B2))
=IF(B:B=B2,ARRAYFORMULA(F2&" "&E2&" "&TEXT(G2,"mm/dd/yyyy")),"")

The column footer band not to print on last page

How can I achieve this? I also tried using "print when expression" with condition
new Boolean($V{PAGE_NUMBER}.intValue() < $V{PAGE_COUNT}.intValue())
but sadly it does not work. Please help me.
This print when expression works fine for me $V{PAGE_NUMBER}<$V{PAGE_COUNT}. It works when applied to either the column footer band or the footer band element (I used static text).
Comparing PAGE_NUMBER and PAGE_COUNT is like comparing apples and oranges.
The Built-In Variables
PAGE_NUMBER: At every iteration it contains the number of the pages that compose the report.
PAGE_COUNT: Contains the number of record processed in the current page
To answer the question: JasperReports knows a band type "Last Page Footer" (wiki description) to define a different footer on the last page.
(Your problem might already be solved. But I stumbled upon this two year old question while having a similar issue and wanted to leave a hint, that one should not compare those variables.)

How to use Parameter field in a record selection "like" statement?

I have designed a report to pull data fields based on a record selection formula that uses a "like" operator that looks for a substring match in a particular field's data, as so:
{rct.serno} like "*9842*"
(due to the free-format way data is stored in the given field, I have to do a substring match to find the relevant rows in the DB.)
This works fine. Instead of manually editing the record selection formula every time, though, I thought to use a Parameter field ("{?TagNum}") to prompt the user for the desired string, and then use that in the record selection formula like:
{rct.serno} like "*{?TagNum}*"
Crystal does not throw an error when I save this record selection formula, but it does not return any records after the report is refreshed, and a parameter value is entered. How can I properly use the parameter value in a record selection substring match?
You're really close to the solution. You can modify the formula in the Select Expert. Just click the Select Expert icon (or from the Report menu). Then click the Formula Editor button. Concatenate or add an asterisk onto the beginning and end of the parameter using the + operator, like this:
{Customers.LastName} like "*" + {?pLastName} + "*"
Let me know if that helps.
~ Nathan

SSRS 2008 R2, using Lookup, Parameters and Row Visibility to do something impossible, it seems

I'm using SSRS 2008 R2 and building a report with Report Builder 3.0. I have 3 parameters that are all used to restrict my data from the same column, the diagnosis code. What my user needs is the ability to restrict up to three levels of potential matches.
For example, they want to be able to select all diagnosis LIKE "Z%" and have those displayed. They want to be able to select all diagnosis LIKE "Z%" and LIKE "W%" and have those displayed but NOT any of those that are ONLY LIKE "Z%". They also want to be able to select all diagnosis that are LIKE "Z%" and LIKE "W%" and LIKE "U%" but NOT those that are ONLY LIKE "Z%" or ONLY LIKE "Z%" and LIKE "W%".
This has proven to be extremely difficult, basically impossible in one SQL query. I tried using UNION but it was still limiting me. Currently, I have created 3 seperate datasets, DXCode1, DXCode 2 and DXCode3, each one connected to a different parameter, allowing the 2nd and 3rd parameters to be NULL. I've got 3 rows in a table on my report to display my diagnosis information. Diagnosis Code (DXCode1) row 1 shows anything LIKE Z%. Diagnosis Code (DXCode2) row 2 shows anything LIKE W% via LOOKUP to my second dataset. Diagnosis Code (DXCode3) row 3 shows anything LIKE U% via LOOKUP to my third dataset.
I have a hidden column in each row that checks the length of my possible matches.
=LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode2"))
ChartNumber is my unique identifier. If there a match on those in DXCode1 and DXCode2, it means there's something I want to show. I use Row Visibility to hide any rows that have a value of 0. I repeat this logic on the next row down as well.
This works to do anything when they are looking for more than one type of diagnosis code. When they ONLY want diagnosis that are LIKE "Z%", I can't use the same logic or else it hides everything. I need something that will hide DXCode2 and DXCode3 if are NULL but will still allow me to hide DXCode1 only if it standing alone and still show my DXCode1, DXCode2 and DXCode3 if they match.
I hope that I have explained myself correctly and that someone can help with a solution.
Actually I got it. I used a text box first to show true or false on the report for all possible combinations. I used this statement:
=IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode1"))>0,"True","False")+IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode2"))>0,"True","False")+IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode3"))>0,"True","False")
This told me if DXCode1 had a value and DXCode2 and DXCode3 did not, it was TrueFalseFalse
If DXCode1 and DXCode2 had a value and DXCode3 did not, it was TrueTrueFalse
If DXCode1 and DXCode2 and DXCode3 had a value, it was TrueTrueTrue
If DXCode1 and DXCode3 had a value and DXCode2 did not, it was TrueFalseTrue
I needed code on my first row visibility telling it if it was TrueFalseFalse and a parameter had been selected (LEN(Parameters!DiagnosisCode.Value)>0), I needed to hide it or if it was TrueFalseTrue and a parameter had been selected, I needed to hide it. That resulted in this code.
=((IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode1"))>0,"True","False") + IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode2"))>0,"True","False") + IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode3"))>0,"True","False")) = "TrueFalseFalse" AND LEN(Parameters!DiagnosisCode2.Value) > 0) OR ((IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode1"))>0,"True","False") + IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode2"))>0,"True","False") + IIF(LEN(Lookup(Fields!ChartNumber.Value, Fields!ChartNumber.Value, Fields!DiagnosisCode.Value,"DXCode3"))>0,"True","False")) = "TrueFalseTrue"AND LEN(Parameters!DiagnosisCode2.Value) > 0)
I also ended up having to change the other rows to accomodate this same logic, The report now works.