CampaignName CONTAINS_ALL ['test', 'play'] Invalid or inapplicable operator is used for field CampaignName - google-ads-api

I have followed the syntax from this doc
withCondition("ColumnName IN [Value1, Value2]")
But I get an error when running this piece of code:
var adGroups = AdsApp
.adGroups()
.withCondition(agName)
.withCondition(campName)
.get();
Error:
5/25/2021 9:32:53 PM CampaignName CONTAINS_ALL ['test', 'play']
5/25/2021 9:32:54 PM Invalid or inapplicable operator is used for field CampaignName. Please check the supported operators. (file Code.gs, line 52)

CampaignName is of string values, so it can use a chained CONTAINS_IGNORE_CASEcondition.

Related

Thymeleaf does not allow "lt" as query string parameter name

I cannot use "lt" as query string parameter name in thymeleaf. How can I achieve that?
This is my example code:
<a th:href="#{/payment/otp-resend(lt=${landingToken.sessionId})}" class="sifretekrar" th:text="#{lp.resendOtp}"></a>
And it gives the following error:
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: "#{/payment/otp-resend(lt=${landingToken.sessionId})}" (template: "otp-entry-page" - line 70, col 12)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:131)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:62)
at org.thymeleaf.standard.expression.StandardExpressionParser.parseExpression(StandardExpressionParser.java:44)
at org.thymeleaf.engine.EngineEventUtils.parseAttributeExpression(EngineEventUtils.java:220)
at org.thymeleaf.engine.EngineEventUtils.computeAttributeExpression(EngineEventUtils.java:207)
at org.thymeleaf.standard.processor.AbstractStandardExpressionAttributeTagProcessor.doProcess(AbstractStandardExpressionAttributeTagProcessor.java:125)
at org.thymeleaf.processor.element.AbstractAttributeTagProcessor.doProcess(AbstractAttributeTagProcessor.java:74)
at org.thymeleaf.processor.element.AbstractElementTagProcessor.process(AbstractElementTagProcessor.java:95)
at org.thymeleaf.util.ProcessorConfigurationUtils$ElementTagProcessorWrapper.process(ProcessorConfigurationUtils.java:633)
at org.thymeleaf.engine.ProcessorTemplateHandler.handleOpenElement(ProcessorTemplateHandler.java:1314)
at org.thymeleaf.engine.OpenElementTag.beHandled(OpenElementTag.java:205)
at org.thymeleaf.engine.TemplateModel.process(TemplateModel.java:136)
at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:661)
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1098)
at org.thymeleaf.TemplateEngine.process(TemplateEngine.java:1072)
at org.thymeleaf.spring5.view.ThymeleafView.renderFragment(ThymeleafView.java:362)
at org.thymeleaf.spring5.view.ThymeleafView.render(ThymeleafView.java:189)
at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1370)
at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1116)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:998)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:890)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:875)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
Best regards.
EDIT
The accepted answer is correct. However, Intellij IDEA shows it as if it has an error. The screenshot is attached below. The following two lines are working while IDE displays error message for both of them:
<a th:href="#{/payment/mps-otp-resend} + '?lt=' + ${landingToken.sessionId}" class="sifretekrar" th:text="#{lp.resendOtp}"></a>
<a th:href="#{/payment/mps-otp-resend('lt'=${landingToken.sessionId})}" class="sifretekrar" th:text="#{lp.resendOtp}"></a>
You can quote lt, which should allow you to use it as a parameter name:
<a th:href="#{/payment/otp-resend('lt'=${landingToken.sessionId})}" class="sifretekrar" th:text="#{lp.resendOtp}"></a>

How to use MySql date format function in queryDsl

code :
Expressions.stringTemplate("DATE_FORMAT({0},'%Y-%M-%D')",qMember.createdDate).eq(keyword)
but it throws:
[268, 317] The right expression is not a valid expression.
and the SQL print in console :
or DATE_FORMAT(member1.createdDate,'%Y-%M-%D') = ?2)
so why?

Date.strptime throwing invalid date for "%Y%W" format

My date = 1st January, 2015.
I did
date_formatted = date.strftime('%Y%W') which returned "201500"
Then when am trying to do Date.strptime(date_formatted, '%Y%W') it's throwing an invalid date error even though the original string was returned from strptime's counterpart srftime.
Found the solution. Time.strptime(date_formatted, '%Y%W') is what will work here.

reserved keyword in dynamodb - Swift 3

Here is code:
queryExpression.keyConditionExpression = "#userId= :userId"
queryExpression.expressionAttributeNames = ["#userId":"userId", "#status":"status"]
queryExpression.expressionAttributeValues = [":userId":userID, ":status":"accept"]
queryExpression.projectionExpression = "status"
but I got the following error and I didnt know that status word is a reserved word in DynamoDB:
Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=0 "(null)" UserInfo={message=Invalid ProjectionExpression: Attribute name is a reserved keyword; reserved keyword: status, __type=com.amazon.coral.validate#ValidationException}
I have looked at the below link but I do not understand it and I can't find a Swift example. How do I accomplish this?
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ExpressionAttributeNames.html#Expressions.ExpressionAttributeNames.ReservedWords
I am new to DynamoDB things.
Thanks!
Here is a list of all the reserved words in DynamoDB:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html
so ExpressionAttributeNames and expressionAttributeValues are ways of aliasing to use #fooattribute and :foovalue even if foo were a reserved word within the above list.
So in your case, I believe your error is because the term status is reserved, you may try changing your last line to be :
queryExpression.projectionExpression = "#status"
That way you wouldn't be using the reserved word, it would read the alias instead. That alias would resolve to your actual attribute name which might as well be status.

How to read json in Rails Controller?

So, I'm doing like that at my controller action:
json_document = JSON(params) (json gem)
If I print json_document it gives me a Json like that:
{"createdAt":"Mar 6, 2012 6:12:54 PM","id":177139718620856322,"text":"#rgjunio where?","source":"web","isTruncated":false,"inReplyToStatusId":177139644012572673, ...
But when I try to access it:
tweet = Complaint.find_by_twitter_status json_document["inReplyToStatusId"]
i get the following error:
can't convert ActiveSupport::HashWithIndifferentAccess into String
So i tried another way using symbols:
tweet = Complaint.find_by_twitter_status json_document[:inReplyToStatusId]
but it gives me the error:
TypeError (can't convert Symbol into Integer)
Any idea?
Update:
If I use params[:inReplyToStatusId] isntead I got the following:
ActiveRecord::StatementInvalid (PG::Error: ERROR: operator does not exist: character varying = bigint
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
SELECT "complaints".* FROM "complaints" WHERE "complaints"."twitter_status" = 177144980450721794 LIMIT 1):
Try:
params[:inReplyToStatusId].to_s

Resources