Is MetroCriteriaId an integer or a string? - google-ads-api

The Google documentation for the GeoPerformance report is a little confusing. On the one hand it says that MetroCriteriaId is of Type Integer but in the Notes it says Name of the metro as a string.
Do anyone know which one is correct, or do I just suck it and see?

It doesn't seem to matter what it is, Int or String, as even in 80812-line report the field is empty. The report definition I used is below and I got data for everything except MetroCriteriaId. Dead field? No idea.
<reportDefinition xmlns="https://adwords.google.com/api/adwords/cm/v201406">
<selector>
<fields>AccountCurrencyCode</fields>
<fields>AccountDescriptiveName</fields>
<fields>AccountTimeZoneId</fields>
<fields>AdFormat</fields>
<fields>AdGroupId</fields>
<fields>AdGroupName</fields>
<fields>AdGroupStatus</fields>
<fields>AdNetworkType1</fields>
<fields>AdNetworkType2</fields>
<fields>AverageCpc</fields>
<fields>AverageCpm</fields>
<fields>AveragePosition</fields>
<fields>CampaignId</fields>
<fields>CampaignName</fields>
<fields>CampaignStatus</fields>
<fields>CityCriteriaId</fields>
<fields>Clicks</fields>
<fields>Conversions</fields>
<fields>Cost</fields>
<fields>CostPerConversion</fields>
<fields>CostPerConversionManyPerClick</fields>
<fields>CountryCriteriaId</fields>
<fields>Ctr</fields>
<fields>CustomerDescriptiveName</fields>
<fields>Date</fields>
<fields>DayOfWeek</fields>
<fields>Device</fields>
<fields>ExternalCustomerId</fields>
<fields>Impressions</fields>
<fields>IsTargetingLocation</fields>
<fields>LocationType</fields>
<fields>MetroCriteriaId</fields>
<fields>Month</fields>
<fields>MonthOfYear</fields>
<fields>MostSpecificCriteriaId</fields>
<fields>PrimaryCompanyName</fields>
<fields>Quarter</fields>
<fields>RegionCriteriaId</fields>
<fields>ValuePerConversion</fields>
<fields>ValuePerConversionManyPerClick</fields>
<fields>ViewThroughConversions</fields>
<fields>Week</fields>
<fields>Year</fields>
<dateRange>
<min>20140601</min>
<max>20140630</max>
</dateRange></selector>
<reportName>Custom Geo Performance Report</reportName>
<reportType>GEO_PERFORMANCE_REPORT</reportType>
<dateRangeType>CUSTOM_DATE</dateRangeType>
<downloadFormat>TSV</downloadFormat>
</reportDefinition>

Related

Can't get SingleValueExtendedProperties from EXO Message with GRAPH

For reference, I read:
Can't get SingleValueExtendedProperties from Outlook contacts for certain data types with GRAPH
Yes, I see that this thread is pretty old, but I hope you will still assist. So I was trying to execute a similar query:
https://graph.microsoft.com/v1.0/me/mailfolders/sentitems/messages/AAAB[truncated]BAAA=?$expand=singleValueExtendedProperties($filter=id%20eq%20'String%200x5D01001E')
This is just POC at the moment as I was noticing the String Comments by Marc in the refered article. This particular property is
Tag: 0x5D01001E
Type: PT_STRING8
Property Name: PR_SENDER_SMTP_ADDRESS_A
Other Names: PR_SENDER_SMTP_ADDRESS, PidTagSenderSmtpAddress, PR_SENDER_SMTP_ADDRESS_W, ptagSenderSMTPAddress
DASL: http://schemas.microsoft.com/mapi/proptag/0x5D01001E
I really would like the Binary property:
Tag: 0x00360003
Type: PT_LONG Property
Name: PR_SENSITIVITY Other
Names: PidTagSensitivity,ptagSensitivity
DASL: http://schemas.microsoft.com/mapi/proptag/0x00360003
When trying either, the query runs without error, but I do not get the MAPI Property. I switched to the PTString8 property PR_SENDER_SMTP_ADDRESS to prove I can get a String, but Eric's post in the referred document seem to make me think he could get a Non String. Both queries run, but no MAPI Property.
Any help would be welcomed. Thanks!
I figured it out! (Also, note that my first example PR_SENDER_SMTP_ADDRESS 0x5D01, is undefined in Sentitems Folder).
*Please Note:
0x0036 = PR_SENSITIVITY
https://graph.microsoft.com/v1.0/me/messages/{MessageID}?$expand=singleValueExtendedProperties($filter=id eq 'Integer 0x0036')
*Substitute the {MessageID} to be the Message Id of the Mail Message in question.

Need to remove numbers with a javascript code step in Zapier

I am not a developer but have used Google search and trial and error test scenarios with Zapier for the last few days and have given up on figuring this out myself. I need help!
I'm using the Run JavaScript code step in Zapier and provided the following details to Input Data.
It says: What input data should we provide to your code (as strings) via an object set to a variable named inputData?
I'm using "street" with a street address example "1402 Spring Garden Rd"
What is the code to use that regardless of the street address provided all the numbers and first space are removed so that the results is "Spring Garden Rd"
Thank you in advance!
var street = inputData;
var streetNoNumbers = inputData.replace(/[0-9]/g, '');
return streetNoNumbers
The error message I'm getting is
TypeError: inputData.replace is not a function
I've learned that strings are immutable and a new string can be made from manipulating another string but doing this in zapier seems to require a function and creating another var with the calculation generates a ... is not a function.
I've tried to write a function but can't get the output or return to show the proper results either.
I can do the following successfully,
var street = inputData
return street
1402 Spring Garden Road
I want to include the code that manipulates street to produce the following:
Spring Garden Road
David here, from the Zapier Platform team. Great question!
The key understanding you're missing is that inputData is a js object with a street property. Before your code is run, we set it up like so:
const inputData = {street: '1402 Spring Garden Rd'}
Since inputData is an object, it doesn't have a replace method (the error you're seeing). Instead, perform your operation on .street and return that.
Try the following:
// need to return an object, not just a string
return {streetNoNumbers: inputData.replace(/[0-9]/g, '')}
If you want to learn more, I recommend our simple examples: https://zapier.com/help/code/#simple-email-extraction

Array.size() returned wrong values (Grails)

I'm developing an app using Grails. I want to get length of array.
I got a wrong value. Here is my code,
def Medias = params.medias
println params.medias // I got [37, 40]
println params.medias.size() // I got 7 but it should be 2
What I did wrong ?
Thanks for help.
What is params.medias (where is it being set)?
If Grials is treating it as a string, then using size() will return the length of the string, rather than an array.
Does:
println params.medias.length
also return 7?
You can check what Grails thinks an object is by using the assert keyword.
If it is indeed a string, you can try the following code to convert it into an array:
def mediasArray = Eval.me(params.medias)
println mediasArray.size()
The downside of this is that Eval presents the possibility of unwanted code execution if the params.medias is provided by an end user, or can be maliciously modified outside of your compiled code.
A good snippet on the "evil (or lack thereof) of eval" is here if you're interested (not mine):
https://javascriptweblog.wordpress.com/2010/04/19/how-evil-is-eval/
I think 7 is result of length of the string : "[37,40]"
Seems your media variable is an array not a collection
Try : params.medias.length
Thanks to everyone. I've found my mistake
First of all, I sent an array from client and my params.medias returned null,so I converted it to string but it is a wrong way.
Finally, I sent and array from client as array and in the grails, I got a params by
params."medias[]"
List medias = params.list('medias')
Documentation: http://grails.github.io/grails-doc/latest/guide/single.html#typeConverters

JSON Parsing issue in Rails

I am seeing a strange issue in Rails.
Request Body (request.body):
renewals[][driver_1][dl_number]=123&
renewals[][driver_1][expiration_date]=20130513&
renewals[][driver_1][last_name]=123&
renewals[][driver_1][state]=AL&
renewals[][driver_1][verified]=1&
renewals[][driver_2][verified]=0&
renewals[][id]=6415&
renewals[][insurance][expiration_date]=20130513&
renewals[][insurance][naic]=123&
renewals[][insurance][policy_number]=123&
renewals[][insurance][verified]=1&
renewals[][mailing_address][address_has_changed]=0&
renewals[][mailing_address][city]=GULF%20SHORES&
renewals[][mailing_address][state]=AL&
renewals[][mailing_address][street_address]=8094%20BEACH%20LANE&
renewals[][mailing_address][zip]=35023&
renewals[][driver_1][dl_number]=123&
renewals[][driver_1][last_name]=123&
renewals[][driver_1][state]=AL&
renewals[][driver_1][verified]=1&
renewals[][driver_2][verified]=0&
renewals[][id]=6412&
renewals[][insurance][expiration_date]=20130513&
renewals[][insurance][naic]=123&
renewals[][insurance][policy_number]=123&
renewals[][insurance][verified]=1&
renewals[][mailing_address][address_has_changed]=0&
renewals[][mailing_address][city]=HUEYTOWN&
renewals[][mailing_address][state]=AL&
renewals[][mailing_address][street_address]=123%20ANY%20LANE&
renewals[][mailing_address][zip]=35023&
renewals[][driver_1][dl_number]=123&
renewals[][driver_1][last_name]=123&
renewals[][driver_1][state]=AL&
renewals[][driver_1][verified]=1&
renewals[][driver_2][verified]=0&
renewals[][id]=6411&
renewals[][insurance][expiration_date]=20130513&
renewals[][insurance][naic]=123&
renewals[][insurance][policy_number]=123&
renewals[][insurance][verified]=1&
renewals[][mailing_address][address_has_changed]=0&
renewals[][mailing_address][city]=HUEYTOWN&
renewals[][mailing_address][state]=AL&
renewals[][mailing_address][street_address]=104%20MERRIMONT%20ROAD&
renewals[][mailing_address][zip]=35023&
JSON Parsed Params (params[:renewals]): https://gist.github.com/t2/5566652
Notice in the JSON that the driver_1 information is missing on the last record. Not sure why this is. The data is in the request. Any known bug I am missing? Let me know if you need more info.
Unfortunately this is just how Rails parses JSON like this (where your [] is massively nested). I've come up against this before - http://guides.rubyonrails.org/form_helpers.html#combining-them gave some explanation.
From what I remember, if you can put in numeric keys rather than just [] (i.e. [1] for the first one, [2] for the second etc.) then it will work as you want it to.
So I figured it out. I needed to set the requestSerializationMIMEType to RKMIMETypeJSON.

Best way of storing an "array of records" at design-time

I have a set of data that I need to store at design-time to construct the contents of a group of components at run-time.
Something like this:
type
TVulnerabilityData = record
Vulnerability: TVulnerability;
Name: string;
Description: string;
ErrorMessage: string;
end;
What's the best way of storing this data at design-time for later retrieval at run-time? I'll have about 20 records for which I know all the contents of each "record" but I'm stuck on what's the best way of storing the data.
The only semi-elegant idea I've come up with is "construct" each record on the unit's initialization like this:
var
VulnerabilityData: array[Low(TVulnerability)..High(TVulnerability)] of TVulnerabilityData;
....
initialization
VulnerabilityData[0].Vulnerability := vVulnerability1;
VulnerabilityData[0].Name := 'Name of Vulnerability1';
VulnerabilityData[0].Description := 'Description of Vulnerability1';
VulnerabilityData[0].ErrorMessage := 'Error Message of Vulnerability1';
VulnerabilityData[1]......
.....
VulnerabilityData[20]......
Is there a better and/or more elegant solution than this?
Thanks for reading and for any insights you might provide.
You can also declare your array as consts and initialize it...
const
VulnerabilityData: array[Low(TVulnerability)..High(TVulnerability)] of TVulnerabilityData =
(
(Vulnerability : vVulnerability1; Name : Name1; Description : Description1; ErrorMessage : ErrorMessage1),
(Vulnerability : vVulnerability2; Name : Name2; Description : Description2; ErrorMessage : ErrorMessage2),
[...]
(Vulnerability : vVulnerabilityX; Name : NameX; Description : DescriptionX; ErrorMessage : ErrorMessageX)
)
);
I don't have an IDE on this computer to double check the syntax... might be a comma or two missing. But this is how you should do it I think.
not an answer but may be a clue: design-time controls can have images and other binary data associated with it, why not write your data to a resource file and read from there? iterating of course, to make it simpler, extensible and more elegant
The typical way would be a file, either properties style (a=b\n on each line) cdf, xml, yaml (preferred if you have a parser for it) or a database.
If you must specify it in code as in your example, you should start by putting it in something you can parse into a simple format then iterate over it. For instance, in Java I'd instantiate an array:
String[] vals=new String[]{
"Name of Vulnerability1", "Description of Vulnerability1", "Error Message of Vulnerability1",
"Name of Vulnerability2", ...
}
This puts all your data into one place and the loop that reads it can easily be changed to read it from a file.
I use this pattern all the time to create menus and for other string-intensive initialization.
Don't forget that you can throw some logic in there too! For instance, with menus I will sometimes create them using data like this:
"^File", "Open", "Close", "^Edit", "Copy", "Paste"
As I'm reading this in I scan for the ^ which tells the code to make this entry a top level item. I also use "+Item" to create a sub-group and "-Item" to go back up to the previous group.
Since you are completely specifying the format you can add power later. For instance, if you coded menus using the above system, you might decide at first that you could use the first letter of each item as an accelerator key. Later you find out that File/Close conflicts with another "C" item, you can just change the protocol to allow "Close*e" to specify that E should be the accelerator. You could even include ctrl-x with a different character. (If you do shorthand data entry tricks like this, document it with comments!)
Don't be afraid to write little tools like this, in the long run they will help you immensely, and I can turn out a parser like this and copy/paste the values into my code faster than you can mold a text file to fit your example.

Resources