This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I would like to configure a macro to write the input file name into a field, capturing the file name from the macro input. I can't rely on the 'Output File Name as Field' option being used, since the file input is outside the scope of the macro. I was hoping there was some sort of function that would parse the source filename from a data stream, but have as yet been unable to find it.
Screen shot attached below, for general reference:
Is the input file outside the macro changing? If so the input file should automatically update the macro input and change the file name field if you choose the 'Output File Name as Field' option. I have tested this and it seems to work for me.
Alternatively there is the field info tool within the developers tab which produces the source file you referenced below. You could then parse the file name using reg-ex or text to column tool from there.
Since I couldn't guarantee the user would have the file name included in advance, I used the Field Info tool as you suggested. From there, I just had to select transpose the Field Info results, then parse the file name from the path. In order to get it back into the output file, I populated the desired _FileName field with "path", then used the Find and Replace tool to replace the word "path" in the _FileName field with the actual file name, from the reference table.
I have a simple macro that reads a folder that has 20+ .txt files with inconsistent schema. just an additional column in few files. So I have used this macro for a while to get this data in a common table. Now I require the file names for each record to be appended to extract some attribution information. when I try to add the filename feature in input tool set inside the macro, the output just appends the template name that's being pointed out rather than the actual file names.
am trying to make use of your macro not am not able to utilize as am very new when it comes to macros. Can you breakdown your WF or give me push to accomplish my ask?