When transferring connector config via a direct link, it does not work for MULTIPLE field. I tried different options:
https://datastudio.google.com/u/0/datasources/create?connectorId=...&connectorConfig={"project_id":"[11]"}&reportTemplateId=...
{"project_id":"11"}
{"project_id":["11"]}
{"project_id":"[\"11\"]"}
function getConfig(request) {
var cc = DataStudioApp.createCommunityConnector();
var config = cc.getConfig();
var option1 = config.newOptionBuilder()
.setLabel("11")
.setValue("11");
var info1 = config.newSelectMultiple()
.setId('project_id')
.setName('Name project')
.addOption(option1)
.setAllowOverride(true);
config.setDateRangeRequired(true);
return config.build();
}
Edit: 10-17-2019
Turns out this was a bug! Thanks for bringing up the issue. It should be resolved now. The correct format is an array of strings (the second 3rd bullet point above).
Related
Let's say I have a website url named:
https://clients.website.com/mock-client/matrix
or
https://clients.website.com/mock-client/Matrix
I'm trying to write some AngularJS code that will take the raw url as shown as an example above and remove the /matrix portion only. The thing is...is that it could be /matrix or /Matrix.
My current code looks like this:
var clientNetworkUrl =
https://clients.website.com/mock-client/matrix
or
https://clients.website.com/mock-client/Matrix
vm.click = function() {
var learnMoreUrl = clientNetworkUrl.replace('matrix', '');
$window.open(learnMoreUrl, '_blank');
};
I would like the output of the function to always strip out /matrix whether it's capitalized or not.
I tried lowercasing the whole url and read that might be a bad idea so I want to take a different approach.
Can anyone help me out with this?
Just use a case sensitive regex
var urls =['https://clients.website.com/mock-client/matrix',
'https://clients.website.com/mock-client/Matrix']
urls.forEach(str => console.log(str.replace(/matrix/gi,'')))
I try to use Google Script Apps (instead of VBA which I am more used to) and managed now to create a loop over different spreadsheets (and not only different sheets in one document) using the forEach function.
(I tried with a for (r=1;r=lastRow; r++) but I did not manage).
It is working now defining the array for the sheetnames manually:
var SheetList = ["17DCu1nyyX4a6zCkkT3RfBSfo-ghoc2fXEX8chlVMv5k", "1rRGQHs_JShPSBIGFCdG6AqXM967JFhdlfQ92cf5ISL8", "1pFDyXgYmvC5gnN5AU5xJ8vGiihwtubcbG2n4LPhPACQ", "1mK_X4Q7ysJQTt8NZoZASBE5zuUllPmmWSJsxu5Dnu9Y", "1FpjIGWTG5_6MMYJF72wvoiBRp_Xlt5BDpzvSZKcsU"]
And then for information the loop:
SheetList.forEach(function(r) {
var thisSpreadsheet = SpreadsheetApp.openById(r)
var thisData = thisSpreadsheet.getSheetByName('Actions').getDataRange()
var values = thisData.getValues();
var toWorksheet = targetSpreadsheetID.getSheetByName(targetWorksheetName);
var last = toWorksheet.getLastRow ()+ 1
var toRange = toWorksheet.getRange(last, 1, thisData.getNumRows(), thisData.getNumColumns())
toRange.setValues(values);
})
Now I want to create the definition of the array "automatically" out of the spreadsheet 'List' where all spreadsheets which I want to loop are listed in column C.
I tried several ideas, but always failed.
Most optimistic ones were:
var SheetList = targetSpreadsheetID.getSheetByName('List').getRange(2,3,lastRow-2,3).getValues()
And I also tried with the array-function:
var sheetList=Array.apply(targetSpreadsheetID.getSheetByName('List').getRange(2,3,lastRow-2,3))
but all without success.
It should be possible normally in more or less one single line to import the array from the speadsheet to the Google apps scripts?
I would very much appreciate if someone could please give me a hint where my mistake is.
Thank you very much.
Maria
I still did not manage to put the array as I wanted it initially, but now I found a workable solution with the For Loop which I want to share here in case someone is looking for a similar solution (and then finds at least my workaround ;) )
for (i=2; i<lastRow;i++){
var SheetList = targetSpreadsheetID.getSheetByName('List').getRange(i,3).getValues()
Logger.log(SheetList);
var thisSpreadsheet = SpreadsheetApp.openById(SheetList);
... // the rest identical to loop above...
Don't hesitate to add your comments or advice anyhow, but I will mark the question as closed.
Thanks a lot.
Maria
I have two arrays
print(">>>>>>>>>>>>>>>>>>>>>>deviceStartList")
dump(deviceStartList)
print(">>>>>>>>>>>>>>>>>>>>>>")
and
print(">>>>>>>>>>>>>>>>>>>>>>deviceEndList")
dump(deviceEndList)
print(">>>>>>>>>>>>>>>>>>>>>>")
It product this result:
I came from a PHP background when I can just call array_diff() , done.
How would one go about doing this?
If you are looking to do something like set subtraction, Swift has that. See Set operations (union, intersection) on Swift array?.
The title of the SO post above doesn't per se mention the methods subtract(_:) or subtracting(_:), but the content of the accepted answer does cite subtract(_:).
In Swift 4.1, You could do something like:
var deviceStartList = ["12345", "67890", "55555", "44444"]
var deviceEndList = ["12345", "55555"]
var deviceStartSet = Set<String>(deviceStartList)
var deviceEndSet = Set<String>(deviceEndList)
let devicesDiff = deviceStartSet.subtracting(deviceEndSet)
And if you need an array as the final output, you can get that by doing this:
var devicesDiffArray = [String](devicesDiff)
Here is a screenshot of a Playground with this working:
This is Set way. Hope it's working for you.
var a=["B8D7","38C9","484B", "F4B7"]
var b=["484B","F4B7"]
Set(a).symmetricDifference(Set(b))
You can try
let result = deviceStartList.filter { deviceEndList.contains($0) == false }
Also I strongly recommend the Set way as it's internally optimized rather than the usual way
I'm looking for a way to change the value (or format) for an individual series label when hovering it in anycharts.
Currently I'm only able to access the entire axis and I can find no getter method for individual labels so as to attach a listener.
xAxis.labels().listen('mouseOver', function(e) {
console.log(this, e.target);
});
This jsfiddle is as far as I got (see console log), this as well as the event.target reference the entire axis but not the label:
https://jsfiddle.net/robstarbuck/pbhd4b7L/9/
Indeed, there was a little bug with cache and format() function, our dev team made the fix, so please check the working sample:
var labelIndex = e.labelIndex;
var label = this.getLabel(labelIndex);
var value = xAxis.scale().ticks().get()[labelIndex];
label.format(value * 2);
https://jsfiddle.net/pbhd4b7L/13/ – it also shows how to work with tick values:
Currently it takes the js from branch, but this fix will be included in the upcoming release – 7.14.0 version (ETA: May 2017)
Our API is a little bit complicated here, but we're working hard to improve it. Does this what you're looking for?
var labelIndex = e.labelIndex;
var label = this.getLabel(labelIndex);
label.fontColor('red');
label.draw();
https://jsfiddle.net/pbhd4b7L/10/
This issue was fixed in the 7.14.0 release, use this code:
xAxis.labels().listen('mouseOver', function(e) {
var labelIndex = e.labelIndex;
var label = this.getLabel(labelIndex);
var value = xAxis.scale().ticks().get()[labelIndex];
label.format(value * 2);
label.fontColor('red');
label.draw();
});
with the latest version: https://jsfiddle.net/2t08ahkg/3/
My goodness, I cannot find an answer for this and I spent several hours already.
How can you reference multiple videos at the same time in video.js?
The API documentation says:
Referencing the Player: You just need to make sure your video tag has an ID. The example embed code has an ID of "example_video_1". If you have multiple videos on one page, make sure every video tag has a unique ID.
var myPlayer = V("example_video_1");
This example shows a single ID, but it doesnt show how I can reference multiple IDs at the same time.
If I have 3 different tags: "video_1", "video_2", "video_3", how do I reference them all?
I tried an array and it didnt work. I also tried listing the videos like this:
var myPlayer = _V_("video_1", "video_2");
and didnt work neither.
Can somebody help me here?
Thank you.
You can't pass multiple ids to _V_(). Either do them one at a time:
var myPlayer1 = _V_("video_1");
var myPlayer2 = _V_("video_2");
var myPlayer3 = _V_("video_3");
Or if you want them as an array:
var myPlayers = Array(_V_("video_1"), _V_("video_2"), _V_("video_3"));
myPlayers[1].play();
Note: this was written for an older version of video.js. _V_() still works but is deprecated: use videojs() instead.
This would also work:
var video = [];
video[1] = _V_("Video1");
video[2] = _V_("Video2");
video[3] = _V_("Video3");
video[4] = _V_("Video4");
video[5] = _V_("Video5");
video[6] = _V_("Video6");
video[7] = _V_("Video7");
video[8] = _V_("Video8");
video[9] = _V_("Video9");
video[10] = _V_("Video10");