select campaign.name from campaign where campaign.name IN

158 views
Skip to first unread message

Max Parsons

unread,
Oct 10, 2022, 10:26:33 AM10/10/22
to Google Ads Scripts Forum
hi!

I am trying to run this
SELECT campaign.name, metrics.cost_micros FROM campaign WHERE metrics.cost_micros > 0 AND campaign.name IN ["-lu","_lu","lu-","lu_"] AND segments.date >= '20220801' AND segments.date <='20221009'

but get this error:
InputError: Report not mapped: campaign at Sh (adsapp_compiled:1690:11) at new aH (adsapp_compiled:17206:15) at new rH (adsapp_compiled:17432:22) at eI.report (adsapp_compiled:18100:12) at fI.report (adsapp_compiled:18245:21) at Object.<anonymous> (adsapp_compiled:19052:54)

could you please point me in the direction to fix it?
thanks!

Rik Mathijssen

unread,
Oct 10, 2022, 11:27:22 AM10/10/22
to Google Ads Scripts Forum
Looks like you need to change the square brackets [ ] into parentheses ( ) in the query.

Try this one:
SELECT campaign.name, metrics.cost_micros FROM campaign WHERE metrics.cost_micros > 0 AND campaign.name IN ("-lu","_lu","lu-","lu_") AND segments.date >= '20220801' AND segments.date <='20221009'

Cheers,
Rik

Max Parsons

unread,
Oct 11, 2022, 2:12:41 AM10/11/22
to Google Ads Scripts Forum
Thanks for the response
if I use "(" instead of "[" I get this error:
InputError: Error in query: Expected [.
 SELECT campaign.name, metrics.cost_micros FROM campaign WHERE metrics.cost_micros > 0 AND campaign.name IN ("-lu","_lu","lu-","lu_") AND segments.date >= '20220802' AND segments.date <='20221010' 
                                                                                                                                                                                                                                                          ^
 at Qh.ld (adsapp_compiled:1680:87) at new aH (adsapp_compiled:17203:22) at new rH (adsapp_compiled:17432:22) at eI.report (adsapp_compiled:18100:12) at fI.report (adsapp_compiled:18245:21) at Object.<anonymous> (adsapp_compiled:19052:54)

I just want to select campaigns containing "-lu".... in their names but I need to do it from report because there are discovery campaigns also

Rik Mathijssen

unread,
Oct 11, 2022, 5:35:55 AM10/11/22
to Google Ads Scripts Forum
Ok. I'm not getting that error, but I do see that you're using campaign.name IN, followed by a list of filters. If you use the IN operand you should provide full campaign names. Other solution could be using campaign.name LIKE '%lu%', but that doesn't look like a very safe filter.. 

Max Parsons

unread,
Oct 11, 2022, 6:13:17 AM10/11/22
to Google Ads Scripts Forum
thanks for your reply :)
I was hoping to find a condition similar to "CONTAINS" or "CONTAINS ANY".
Could I use : LIKE '%{-,_,""}lu {-,_,""}%' ?
I want campaings that contains lu-,lu_ , -lu,_lu 

Google Ads Scripts Forum

unread,
Oct 25, 2022, 6:06:54 AM10/25/22
to Google Ads Scripts Forum
Reposting the last inquiry (https://groups.google.com/g/adwords-scripts/c/4G8CUtJZ3xs) from the forum as it wasn't routed to our support queue.

Regards,
Yasmin
Google Ads Scripts Team

Google Ads Scripts Forum

unread,
Oct 25, 2022, 6:29:08 AM10/25/22
to Google Ads Scripts Forum
Hello,

This is Yasmin from the Google Ads scripts team.

You may try basing from this link on how you may apply this condition.

Let us know if we can assist you with anything else.


Regards,
Yasmin
Google Ads Scripts Team

Reply all
Reply to author
Forward
0 new messages