I need to list files by folderId
Using the reference code.
https://developers.google.com/drive/v2/reference/children/list
ERROR : Call to a member function listChildren() on null
use This code $service->files->listFiles(array('q' => "'<FOLDER_ID>' in parents"));
Related
context: azure - ADF brief process description:
Get a list of the fields defined in the first row of a .csv(blobed) file. This is the first step, detect fields
then 2nd step would be a kind of compare with actual columns of an SQL table
3rd one a stored procedure execution to make the alter table task, finishing with a (customized) table containing all fields needed to successfully load the .csv file into the SQl table.
To begin my ADF pipeline, I set up a lookup activity that "querys" the first line of my blobed file, "First row only" flag = ON.As a second pipeline activity, an "Append Variable" task, there I would like to get all .csv fields(first row) retrieved from the lookup activity, as a list.
Here is where a getting the nightmare.
As far I know, with dynamic content I can get an array with all values (w/ format like {"field1_name":"field1_value_1st_row", "field2_name":"field2_value_1st_row", etc })
with something like #activity('Lookup1').output.firstrow.
Or any array element with #activity('Lookup1').output.firstrow.<element_name>,
but I can't figure out how to get a list of all field names (keys?) of the array.
I will appreciate any advice, many thanks!
I would save the part of LookUp Activity because it seems that you are familiar with it.
You could use Azure Function HttpTrigger to get the key list of firstrow JSON object. For example your json object like this as you mentioned in your question:
{"field1_name":"field1_value_1st_row", "field2_name":"field2_value_1st_row"}
Azure Function code:
module.exports = async function (context, req) {
context.log('JavaScript HTTP trigger function processed a request.');
var array = [];
for(var key in req.body){
array.push(key);
}
context.res = {
body: {"keyValue":array}
};
};
Test Output:
Then use Azure Function Activity to get the output:
#activity('<AzureFunctionActivityName>').keyValue
Use Foreach Activity to loop the keyValue array:
#item()
Still based on the above sample input data,please refer to my sample code:
dct = {"field1_name": "field1_value_1st_row", "field2_name": "field2_value_1st_row"}
list = []
for key in dct.keys():
list.append(key)
print(list)
dicOutput = {"keys": list}
print(dicOutput)
Have you considered doing this in ADF data flow? You would map the incoming fields to a SQL dataset without a target schema. Define a new table name in the dataset definition and then map the incoming fields from your CSV to a new target table schema definition. ADF will write the rows to a new table using that file's schema.
I am practicing ES6 on freeCodeCamp. Currently, I am solving a problem related to topic Template Literals. The problem statement is like
Use template literal syntax with backticks to display each entry of the result object's failure array. Each entry should be wrapped inside a li element with the class attribute text-warning, and listed within the resultDisplayArray.
After executing the code all test cases are passed except one
Template strings were used
and I am getting the error
Invalid regular expression flags
Please see below code and tell me where I am doing wrong.
const result = {
success: ["max-length", "no-amd", "prefer-arrow-functions"],
failure: ["no-var", "var-on-top", "linebreak"],
skipped: ["id-blacklist", "no-dup-keys"]
};
function makeList(arr) {
"use strict";
// change code below this line
const resultDisplayArray = arr.map(value =>
`<li class="text-warning">${value}</li>`);
// change code above this line
return resultDisplayArray;
}
/**
* makeList(result.failure) should return:
* [ <li class="text-warning">no-var</li>,
* <li class="text-warning">var-on-top</li>,
* <li class="text-warning">linebreak</li> ]
**/
const resultDisplayArray = makeList(result.failure);
Your code is correct and clear!
It is a bug at freeCodeCamp as you can see on this GitHub thread.
Cheers
Run the followings swift codes in the 'Playground' but line2 get an error as shown below, why cannot access the optional value for the dictTest[1]! ?
var dictTest: [Int:String]? = [1:"A"]
dictTest[1]!
error:
value of optional type '[Int : String]?' not unwrapped; did you mean
to use '!' or '?'? dictTest[1]!
Modify the swift's code as shown below :
var dictTest: [Int:String]? = [1:"A"]
var dictTest2: [Int:String] = dictTest!
dictTest2[1]
I think the trick is that we have to unwrap the optional value before use it. Anyone who have the best answer, please advise!
So the following code I had worked when the Function was in the same Workbook as my Sub:
FDError= FilterData(sh, current)
But now its been moved to another workbook and I have to call it from there I'm getting an error (Run-time error 13: Type Mismatch):
FDError = Application.Run("'" & rwb.Name & "'!FilterData", "sh", "current")
Here's the help to Application.Run: http://msdn.microsoft.com/en-us/library/office/aa220716(v=office.11).aspx
The problem is that you didn't provided the actual arguments required by the macro in order to run, but rather their names as strings. You'd want to call:
FDError = Application.Run("'" & rwb.Name & "'!FilterData", sh, current)
where sh and data should be two variables that have the correct type (i.e. they are, or can be converted to, Variant), and are properly initialized.
I would like to trigger a method of an object by using BINDEVENT(), but the method may not exist. Thus, I want to check if the method is defined before issuing BINDEVENT().
For example, in the following code snippet, if oHandler.myresize() does not exist, the error will be triggered at the line of BINDEVENT().
PUBLIC oHandler
oHandler=NEWOBJECT("myhandler")
DO (_browser)
BINDEVENT(_SCREEN,"Resize",oHandler,"myresize")
DEFINE CLASS myhandler AS Session
PROCEDURE myresize
IF ISNULL(_obrowser) THEN
UNBINDEVENTS(THIS)
ELSE
_obrowser.left = _SCREEN.Width - _obrowser.width
ENDIF
RETURN
ENDDEFINE
Thus, I want to check the method myresize() exists or not.
Is there any language function for this purpose? It is very similar to a php function function_exits() or method_exists().
PEMSTATUS( VariableNameRepresentingTheObject, "MethodOrPropertyLookingFor", 5 )
returns true or false if exists on the given object.