Nested IFNA in array Google Sheets - google-sheets

I have the below code. The Course Name, Delivery and Completion Date mismatches work as expected. However I am trying to implement one final row for email mismatch. If the email can't be found in the "another google sheet" I want it to return E-mail mismatch, but it looks as though the iferror is suppressing it. Thoughts/Help?
Thank you in advance.
=ArrayFormula(iferror(if(row(C:C)=1, "Unverified Reason",
IF(ISNA(LOWER(VLOOKUP(C:C,importrange("anothergooglesheet","Course Completion!B:F"),1,0)),"E-Mail Mismatch",
IF(LOWER(VLOOKUP(C:C,importrange("anothergooglesheet","Course Completion!B:F"),4,0))<>LOWER(I:I),"Course Name Mismatch",
IF(LOWER(VLOOKUP(C:C,importrange("anothergooglesheet","Course Completion!B:F"),5,0))<>LOWER(T:T),"Delievery Method MisMatch",
IF(TO_DATE(INT(VLOOKUP(C:C,importrange("anothergooglesheet","Course Completion!B:F"),3,0)))<>F:F,"Completion Date Mismatch",""))))))))
EDIT: I got what I needed by using the following.
=ArrayFormula(iferror(if(row(C:C)=1, "Unverified Reason",
if(A:A="","",
IF(LOWER(VLOOKUP(C:C,importrange("anothergooglesheet","Course Completion!B:F"),4,0))<>LOWER(I:I),"Course Name Mismatch",
IF(LOWER(VLOOKUP(C:C,importrange("anothergooglesheet","Course Completion!B:F"),5,0))<>LOWER(T:T),"Delivery Method MisMatch",
IF(TO_DATE(INT(VLOOKUP(C:C,importrange("anothergooglesheet","Course Completion!B:F"),3,0)))<>F:F,"Completion Date Mismatch",""))))),"Potential E-Mail Mismatch"))

try:
=ARRAYFORMULA({"Unverified Reason";
IF(IFNA(LOWER(VLOOKUP(C2:C, IMPORTRANGE("anothergooglesheet","Course Completion!B:F"),1,)), "E-Mail Mismatch"),
IF(LOWER(VLOOKUP(C2:C,IMPORTRANGE("anothergooglesheet","Course Completion!B:F"),4,))<>LOWER(I:I), "Course Name Mismatch",
IF(LOWER(VLOOKUP(C2:C,IMPORTRANGE("anothergooglesheet","Course Completion!B:F"),5,))<>LOWER(T:T), "Delievery Method MisMatch",
IF(TO_DATE(INT(VLOOKUP(C2:C,importrange("anothergooglesheet","Course Completion!B:F"),3,)))<>F:F, "Completion Date Mismatch",))))})

Related

Google Sheets API "(Google::Apis::ClientError)" [duplicate]

I am trying to access Google spreadsheets using a spreadsheet example. When I run the example code it worked fine. I just change the SpreadsheetId and range. It started giving me:
Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Unable to parse range: Class Data!A2:A4",
"reason" : "badRequest"
} ],
"message" : "Unable to parse range: Class Data!A2:A4",
"status" : "INVALID_ARGUMENT"
}
at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:113)
at com.google.api.client.googleapis.services.json.AbstractGoogleJsonClientRequest.newExceptionOnError(AbstractGoogleJsonClientRequest.java:40)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest$1.interceptResponse(AbstractGoogleClientRequest.java:321)
at com.google.api.client.http.HttpRequest.execute(HttpRequest.java:1065)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:419)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.executeUnparsed(AbstractGoogleClientRequest.java:352)
at com.google.api.client.googleapis.services.AbstractGoogleClientRequest.execute(AbstractGoogleClientRequest.java:469)
at poc.mainPOC.main(mainPOC.java:157)
Below is the code:
String spreadsheetId = "my spread sheet ID";
String range = "Class Data!A2:A4";
ValueRange response = service.spreadsheets().values()
.get(spreadsheetId, range)
.execute();
Try replacing Class Data!A2:A4 with A2:A4
If you look at the sheet itself you will notice that the Worksheet is titled "Class Data". So just put the name of your sheet where is says "Class Data". Example:
String range = "SheetName!A1:C";
String range = "Class Data!A2:A4";
The Class Data is your worksheet's name, FYI: the name on the tab at the bottom, the default one is "Sheet1". Replace Class Data with the one you want to work with.
I was trying to add some data to a sheet named Emmett that did not existed yet and was receiving this error:
Error: Unable to parse range: Emmet!A2:C12
I had to manually create the sheet named Emmett in the spreadsheet and then it worked like a charm.
I ran into this error when I had a typo in the name of the tab. In your case "Class Data" didn't match the name of the tab
In my case there was an extra space in the google sheet while I was trimming the sheet name at my end. Once I removed the trimming logic, everything worked fine.
Something that I learned was that If the column name doesn't exist yet, this command won't be able to find it. You need to make sure the column you're writing to already exists -- I did this manually from the google sheet.

How do I set the name a child in Firebase to user input from a text field?

Here's how I want my data tree to look in Firebase:
users:
--Travis:
------travisData:
--Stephanie:
------stephanieData:
My problem is that I can't seem to name a child using user input from a textfield.
Here's the code I have so far:
ref = Database.database().reference()
let username = String(emailTextField.text!)
//ref.child("users").setValue(["username": username])
ref.child("users").setValue(["\(username)": calendar])
The commented out line creates a child named "username" with the textfield.text as its content. But how can I create a child whose name is the textfield.text, with other data as its content? I've tried multiple combinations of using .child and .setValue, but everything keeps throwing me an error when I try to use the username variable instead of a plain string.
Here's the error I get:
Your problem is that Firebase doesn't accept the "." symbol in their user names. You would get the same problem even if you typed a string of letters with a "." such as "adfojnajsdnfjs.fjknasd" instead of "username".
I think you're looking for:
ref.child("users").child(username).setValue(calendar)
Although that depends on the value of calendar.
At the very least this should work:
ref.child("users").child(username).setValue(true)
And give you the following JSON:
"users": {
"Travis": true
}
To write a more complex structure, you can for example do:
ref.child("users").child(username).child("name").setValue(username)
Which results in:
"users": {
"Travis": {
name: "Travis"
}
}
As your require, I think this code will help you
ref.child("users").child("\(inputUsername)").updateChildValues(["travidDataKey": userData])
And
result image
users:
Travid2:
travidDataKey:"Travid Data"

When I run sql query there is no alert

This code insert the record into the basetable without alert.
CurrentDb.Execute _
"INSERT INTO basetable(clName,clId,clGender) VALUES('test','123','');"
I expected this code should pop alert up because the clGender field set to be "required", but no alert. Could you please tell me where I was wrong.
You can use:
DoCmd.RunSQL " Insert ... "
though that may be too much.
The reason you didn't get an alert is because you supplied a value for clGender. In table design view there are two relevant properties: Required and Allow zero length. Your clGender field has both of these set to true. The Required setting means that you can't save the record with this field as Null but in your insert statement you haven't specified Null, you've specified an empty string, which is allowed by the Allow zero length setting.
[EDIT]
Sorry, just realised what's going on. The Execute method doesn't give you any feedback directly. However you can use the RecordsAffected property to see if it did what you expected.
Dim db As DAO.Database
Set db = CurrentDb()
db.Execute "INSERT INTO basetable(clName,clId,clGender) VALUES('test','123','')"
If db.RecordsAffected = 0 Then
MsgBox "Insert failed"
End If
Set db = Nothing

Access 2010 multiple field textbox not showing all

A textbox in a report I am trying to show properly is hiding multiples, even though the second field is different.
For example: "=[Client] & " " & [Invoice]".
If there is a Bob with multiple invoices, the report will only show one Bob and the lowest invoice number.
How can I make the textbox show every client and invoice individually?
Thanks.
Edit: The SQL requested
"SELECT [SUMFCRR&Plaintiff].Firm, [SUMFCRR&Plaintiff].[Firm Type], IIf([ReportID] Is Null,0,Val([ReportID])) AS [Report #], [SUMFCRR&Plaintiff].SumOfFeesBilled, [SUMFCRR&Plaintiff].[SumOfRecommended Reduction], [SUMFCRR&Plaintiff].[SumOfCosts Billed], [SUMFCRR&Plaintiff].[SumOfCost Reduction], [SumOfFeesBilled]+[SumOfCosts Billed]+[SumOfRecommended Reduction]+[SumOfCost Reduction] AS Reimbursement, [SUMFCRR&Plaintiff].Plaintiff, [SUMFCRR&Plaintiff].ReportID, [SumOfRecommended Reduction]+[SumOfCost Reduction] AS ReductionSum, [SUMFCRR&Plaintiff].Invoice, ([SumOfFeesBilled]+[SumOfRecommended Reduction]) AS FeeReimbursement, ([SumOfCosts Billed]+[SumOfCost Reduction]) AS CostReimbursement, -[SumOfRecommended Reduction] AS PositivefeeReduction, IIf([positivefeereduction]>[sumoffeesbilled] Or [sumofcost reduction]>[sumofcosts billed],"E"," ") AS ErrorNote, -[sumofcost reduction] AS PositveCostReduction
FROM [SUMFCRR&Plaintiff]
WHERE ((([SUMFCRR&Plaintiff].Firm) Like [which firm?] & "*") AND (([SUMFCRR&Plaintiff].ReportID)=[which report?]))
ORDER BY IIf([ReportID] Is Null,0,Val([ReportID]));"
Edit2: The two fields of concern here are [Plaintiff] and [Invoice], and all information is shown when I run the query itself.
Fixed it. It was originally in the [Plaintiff] grouping. I changed the group to [Invoice], and the multiple invoice numbers started showing.

Override Grails Error Messages to format Dates and Numbers

I have created a domain with a Double field. When the validation occurs it throws the error message with size value showing the number with commas. Following are the detials
Groovy Class
class Quote {
String content;
Double size;
static constraints = {
content(maxSize:1000, blank:false)
size(min: 0.00D, max:999.99D)
}
}
Value entered "11111", error obtained "Size 11,111 is exceeded the limit". I have added the property key/value pair in messages.properties.
Here, I would like to get the message back without the commas. My main aim is to take the key and format the message returned based on my requirements. I require this as I have other fields that need conversion. For example, a date is validated but when showing the error the Gregorian date needs to be converted to an Islamic date and shown to user.
Does anyone know if I can do something to make this work.
I have tried the solution provided in http://ishanf.tumblr.com/post/434379583/custom-property-editor-for-grails but this did not work.
I have also tried modifying the messages values, but this is not flexible in case of my date issue. Example, for a key value pair, instead of using {2} as a place holder I could use {2, date, mm/dd/yyyy}, but for Islamic dates I want to format and show things differently.
Also, please note I have created a separate key for default date formatting for my application.
Would appreciate the help.
In grails, the return of a constrain is an already translated string.
You can create a taglib to format that, or enhance the
Another option would be custom validators. A custom validator can return false or a key when failing.
For example in your domain class, to vaildate a field:
myDateField validator: {val, obj -> obj.myShinyDateValidatorMethod(val) }
private myShinyDateValidatorMethod() {
if (isNotValidDate(val) {
return [the_message_key, val.formatedAsYouWand]
}
}
and, in your properties file you have to have defined the key:
the_message_key=This date: {3} is not valid
The trick here is that in the return from the validator, first string is the key and the rest are parameters for that key, but grails already uses {0}, {1}, {2} placeholders for className, fieldName and value, and the first parameter that you pass will be used as {3} placeholder.
Hope this helps

Resources