Hi there. Let's start with a simplified example. Let's say we have the following M, which defines a custom function and also invokes it.
let
f = (x) => x + 1
in
f(2)
If you wanted to add a parameter to the function, you could modify the code like so:
let
f = (x, y) => x + y
in
f(1, 2)
In terms of the queries that get generated as part of combining files from a folder, doing this is a bit more tricky. Here are the steps:
- Create a parameter that represents the additional info you want to pass downstream (for example, FileName)
- Set the parameter's value to the name of the sample file
- Use the new parameter in your "Transform Sample File" query (for example, add a custom column that contains the FileName)
- The "Transform File" function will now contain an additional parameter. This will cause downstream errors because the invocations of "Transform File" will not be passing this new parameter.
- Update the invocations of "Transform File" to provide this parameter. For example, when invoking the function against a folder of files, simply pass [Name] in addition to [Content]. When invoking the function against the "Sample File", pass FileName.
Hopefully this helps. Let us know if you have further questions.