Context-free Exportations and Importations

Idea created by Fred(CH) on Nov 16, 2015
    Active
    Score12

    Summary


    It would be nice to have a way to standardize exportation and exportation, where the choice of the context / Table occurrence (OT) could be programmatically determined.

     

    Why ?

     

    As we saw in previous best-seller posts in this Idea section, Exportation and Importation are some important parts of our database feature set, especially scripted ones. However, as i generally try to minimize the number of scripts and steps by creating generic / reusable ones, with as much indirections as i can, i realize the "incompressible" part of script are most of the time Importation / Exportation steps.

     

    An example :

     

    Just take a look at this bit of script :

     

    # Assuming each FileMaker table / PTO have a basic layout where both names matches

    Set Variable [ $table_list; Value : ExecuteSQL ( “SELECT DISTINCT BaseTableName FROM FileMaker_Tables” ; “” ; “”  ) ]

    Set Variable [ $source_path; Value : "file:SOURCE_FILE.fmp12" ]

    Loop

      Set Variable [ $i; ; Value: $i + 1 ]

      Set Variable [ $table; Value: GetValue ( $table_list ; $i ) ]

      Go to Layout [ $table ]

      Show All Record

      # Assuming the step is configured with matching names

      Import Records [ $table ; No dialog; $source_path ; Replace; UTF-16]

      End Loop if [ $i = ValueCount ( $table_list ) ]

    End Loop

    Go to Layout [ original layout ]

     

    Where the step in red is in real world :

     

    If [0 // easy to rearrange]

    Else If [$i = 1 ]

       Import Records [ No dialog; $source_path ; Replace; UTF-16]

    Else If [$i = 2 ]

       Import Records [ No dialog; $source_path ; Replace; UTF-16]

    <And so on... and so on…>

    Else If [$i = 99 ]

       Import Records [ No dialog; $source_path ; Replace; UTF-16]

    End If