I am trying to create a main job in Talend that would scan a directory for multiple files (f1.csv, f2.xls...)and then run a separate job created for the specific file. I would like to create a context variable that captures the filename and calls the appropriate job. How can I setup the context variable to store the filename of the found file and pass it to the other jobs?
Create a job called child_job. Inside, go to context tab, and create a new context variable called file with the type String. Inside, you can put components that references this context.file variable.
Now, create another job called main_job. Inside it, put a tFileList. Configure the settings in this component with the desired path where you want to find the files. Then, drag the child_job from the left panel (job designs) or put a tRunJob and set it to call the child_job job. Finally, join the tFileList with the iterate link with the child_job, select the child_job, go to Component tab, add a parameter (the file parameter that you created before) and set the value to ((String)globalMap.get("tFileList_1_CURRENT_FILE")) and you are done!
Something like that:
Related
I am setting a property value through JSR223 pre-procesor and want to use this property for source directory in Directory Listing Data Source but, not been succesful. Here's how i am trying to do it.Have i missed something?
setpropertyvalue
usepropertyindirectorylisting
The reason I want to do this is because I want to use files from different folder in each thread. I have named folders as ABC1, ABC2, ABC3 etc...and that is why i want to use thread number function for ABC${threadNum}. But, i am not able to achieve it.
It should work fine given you set the property before the directory listing config is initialized.
Take a look at JMeter Test Elements Execution Order
0. Configuration elements
1. Pre-Processors
2. Timers
3. Sampler
4. Post-Processors (unless SampleResult is null)
5. Assertions (unless SampleResult is null)
6. Listeners (unless SampleResult is null)
So as you can see Configuration Elements are being executed before anything else so you either need to
define your property in another configuration element which will be executed before the Directory Listing Config such as User Defined Variables
or move your code to setUp Thread Group
or provide the property value via -J command-line argument
In macOS, I want a folder action to trigger when I place a new file in that folder. The action should grab the filename, not including the path, and use that as the subject, and then attach the file to an email message and send it. Ideally, this would happen behind the scenes as I don't need to see the activity.
I created an Automator script that can grab the file, extract the name, create and send the file. But it's a bit of a kludge. Once I set a variable to the filename, I lose the attachment and have to get the finder item again. Also, it's not working as a Folder Action which is what I really need.
The Automator includes these steps:
Get Specified Finder Items
Get Folder Contents
Filter Finder Items -- I'm only interested in specific files
Set Value of Variable
--path
Run Shell Script -- extract only the filename without the extension
--basename "$#" .pdf
Set Value of Variable
--fileName
New Mail Message
--Subject: fileName
At this point I no longer can attach the specified file because Automator has 'lost' it, so I have to start over with the Get Specified Finder Items, Get Folder Contents, Filter Finder Items, Add Attachments to Front Message. Finally, Send Outgoing Messages.
What I want to happen is when I place a certain file into a directory, the Folder Action triggers, it looks at the file, and if it meets the filter criteria it emails the file, using only the filename without the extension as the Subject.
Create an Automator document type that is a folder action, and attach it to the desired folder. Items added to the specified folder will be passed on to the workflow, so you don’t need to use additional actions to get them.
You are already saving the filtered item paths in a variable, you just need to get them back for the Mail action:
Folder Action receives files added to { wherever }
Filter Finder Items
Set Value of Variable { Variable: path }
Run Shell Script
Set Value of Variable { Variable: fileName }
Get Value of Variable { Variable: path } (ignore input)
New Mail Message { Subject: fileName } (passed files are attached)
Automator workflows are designed to work with multiple input items as a batch; dealing with items one at a time would require a script or third party action such as Dispense Items Incrementally.
I'm using the environment variable $PMTargetName#numAffectedRow, but the TargetName is a parameter(parfile)
I'm trying to do this way:
$PM$$SOURCE_TABLE#NumAffectedRows
Is not working :/
What you need to use here is the name of the Target Transformation, not the table name. So assuming you've got a Target Transformation named MyTargetTable and you use the Target Table Name property to set the actual table name to e.g. Customers, then:
$PMMyTargetTable#TableName should give you Customers
and $PMMyTargetTable#NumAffectedRows should get you what you're looking for
The variables to be used in pre/post session commands need to be passed to the session from parameter file. e.g. $PMTargetName should be used in your session e.g. as Target Table Name. If you are doing this, then this will work - ${PMTargetName}#numAffectedRow. Adding parentheses will ensure your variable is expanded before #numAffectedRow is appended to it.
If you are not using $PMTargetName anywhere in your session then IS will not expand it. You should declare it as your workflow variable. And since you have already defined it in parameter file...rest should work.
I'm trying to process the Ctrl+Z ( Undo Delete ) context menu action in my namespace extension, but I'm having trouble finding a way to do this.
I see in the doc that one needs to implement FM_UNDELETE_PROC, but no details on how to register this callback.
Also tried to set a Shell hook, but no relevant messages arrive there.
Any thoughts?
Also, how would one register a delete operation so the explorer would allow the Undo to take place.
Now it appears if I do this from another location.
Thanks,
David
Windows has per process (prior to Vista) or global file operation stack. If you use API functions like SHFileOperation or IFileOperation interface you can pass FOF_ALLOWUNDO flag BUT this flag is ignored if the source file parameter does not contain fully qualified path and file names. It means if you want use system file operation stack your shell extension objects MUST have SFGAO_FILESYSTEM attribute and you MUST return valid file path and name when IShellFolder.GetDisplayNameOf is called with SHGDN_FORPARSING parameter. Also it is necessary to implement ITransferSource and ITransferDestination interfaces. So if objects don`t not have SFGAO_FILESYSTEM attribute you must use your own implementation of operation stack.
Undo Delete command in background context menu of folder or in Edit menu is system command and it has no any relation to your shell extension. And you should not process the Ctrl+Z manually.
How do I unimport a file from vbscript? Because the file I imported has a lot of global variables, which coincides with the other file I want to import.
I just want to import 1 file at a time in order to prevent overlapping of global variables. How do I achieve that? Thanks.
All data made available to a current script context MUST be unique. If you use 'ExecuteGlobal statement' in the main context, routine or function then all data is available globally. Use 'Execute statement' to make data available in a current context.
http://msdn.microsoft.com/en-us/library/342311f1(VS.85).aspx