Loop through database tables

ammargh
ammargh New Altair Community Member
edited November 5 in Community Q&A

RM has a "loop data sets" component.

My data sets are saved in a database. Is there is a way to loop through all database tables?

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee

    hi,

     

    not with one operator. You can write a SQL statement generating you table of table names and use a Loop Values on it to get each table name as a macro. You can then use this table in the loop.

     

    ~Martin

  • JEdward
    JEdward New Altair Community Member

    Yes, you can use the Loop Repository operator and instead of pointing at your local repository point at the //DB/ where your stored connections are. 

    Below is a quick example.

     

    <?xml version="1.0" encoding="UTF-8"?><process version="7.4.000">
    <context>
    <input/>
    <output/>
    <macros/>
    </context>
    <operator activated="true" class="process" compatibility="7.4.000" expanded="true" name="Process">
    <process expanded="true">
    <operator activated="true" class="loop_repository" compatibility="7.4.000" expanded="true" height="82" name="Loop Repository" width="90" x="179" y="136">
    <parameter key="repository_folder" value="//DB/DemoDataStore/Example Sets/"/>
    <parameter key="entry_type" value="IOObject"/>
    <process expanded="true">
    <connect from_port="repository object" to_port="out 1"/>
    <portSpacing port="source_repository object" spacing="0"/>
    <portSpacing port="source_in 1" spacing="0"/>
    <portSpacing port="sink_out 1" spacing="0"/>
    <portSpacing port="sink_out 2" spacing="0"/>
    </process>
    </operator>
    <connect from_op="Loop Repository" from_port="out 1" to_port="result 1"/>
    <portSpacing port="source_input 1" spacing="0"/>
    <portSpacing port="sink_result 1" spacing="0"/>
    <portSpacing port="sink_result 2" spacing="0"/>
    </process>
    </operator>
    </process>