Pass input table name as parameter

Hello,

In projects I need to generate many tables that do compare large sets of data, then export the calculated diff items from the table to files. Export logic and actions are always the same: skip on condition (if table is empty), then apply some actions, then export to delimited text file or whatever, with name of the file being the name of the “diff” table I want to export.

Thus, I would like to create a kinda generic module / project that would take care of exporting file. Rather than always duplicating the very same actions and then update dozens of actions if i do change anything in my export workflow (file naming, whatever), I could build some “util” that just needs to be used with a Call module/project action.

However, I cannot find out how to pass the calling table name as parameter to my module so that i can use this paramater dynamically to build the file name. Or maybe there is another way to achieve my goal ?

Thanks by advance and regards.

David

Did you check transformations:metadata [EasyMorph Help]?

The “Table metadata” action mentioned by @bolud could’ve helped but it replaces the current dataset. It looks like, we need to add an option to append columns with metadata to the current dataset.

Meanwhile, you can explicitly pass the table name as a parameter to the called module.

Thx @bolud @dgudkov . Will do in the meanwhile.

FYI I also tried to pass a calculated parameter using metadata(‘current table’) to the module, but it’s not evaluated and is always empty. Normal, as I guess parameters are evaluated on project opening and not real-time.
I did also think about using shared memory, but I guess I would then need to chain all my tables to avoid synchronization issues and make sure that the right data is always remembered / recalled without overriding between processes.

Oops I meant to say metadata(‘current table’)
But looks like it was used already.

Can you elaborate on that?

The idea is to have generic modules, always performing the same actions on some tables, e.g. get a file in csv and “convert” to .dset after some repetitive cleaning or save a file after some conditions checking, etc. to avoid always repeating the same actions in my workflow tables. And I need to be “table name” based in the output naming.

SaveToCsv.zip (8.3 KB)

I tried to use a calculated parameter in my main module that would calculate the name of the table by using metadata(‘current table’) function. But (as expected I guess ;-)) it always evaluates to empty.

Totally forgot about metadata(‘current table’) :slight_smile:

It evaluates to empty because it’s evaluated outside of a table context, i.e. there is no “current table” where it evaluates.

I’ve reworked your example. It now contains two ways how to generalize passing a table name to the called module:

  1. Use the “Iterate another table” action. In this case, it passes the name of the table that contains the action, not the table with the main dataset.

  2. Pass the table name as a column into the called module, and then delete the column before exporting.

GENERIC_EXPORT_METADATA_TABLE.morph (9.8 KB)

Thanks @dgudkov. I will go with the second option.

However, I think that providing in the future the ability to use this “table name as it was before entering the module” would be super useful to implement generic modules such as the ones I described :slight_smile: Easy and much more autmated loading / cleaning / saving to other formats of “similar” datsources and so on.

I will continue digging and btw, EasyMorph is a superb ETL !

1 Like