Jump to content

Tweaks to Omit Fields


alecgregory
 Share

This topic is 2924 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I've been working with the beta this weekend and really liking it. Logging record views is particularly good to see as I've always wanted to be able to provide stats for this sort of thing to managers, so they can see how their users behave.
 
I've made a couple of changes to the version I have in my current solution and thought I'd post them here in case anyone else was after the same functionality. I've tried to stay true to the coding style in the framework and implemented the changes via the settings script and existing scripts.

 

These work for me but I've not tested extensively so proceed with caution.
 
Changes

  • Omitting EA fields when you have changed their names
  • Omitting fields from all or particular tables without renaming to include the 'EXCL_' prefix

Omitting EA fields when you have changed their names
 
In the scripts "EasyAudit - Commit - Server" and "EasyAudit - Log Single Record - Server" Change the Set Variable ($fields) Step to the following calculation:

// Modified to allow excluding ea_fields when they have custom names

ExecuteSQL (
  "SELECT
    FieldName, FieldReps
  FROM
    FileMaker_Fields
  WHERE
    (
      TableName = ?
    )
  AND
    (
      FieldType NOT LIKE 'global%'
    )
  AND
    (
      FieldName NOT LIKE 'EXCL_%'
    )" &
    If (
      $$omit_ea_fields; 
        " AND
            (
              FieldName NOT IN
                ( '" &
                  Substitute (
                    List (
                      $$EA_UUID;
                      $$EA_Modifier;
                      $$EA_Mod_Timestamp;
                      $$EA_Mod_Count
                    ); ¶; "','"
                  ) & "'
                )
            )"
    );
  "|";
  ¶;
  $table_occurrence_name
)

// Original

/*
ExecuteSQL ( "SELECT FieldName, FieldReps FROM FileMaker_Fields WHERE ( TableName = ? ) AND ( FieldType NOT LIKE 'global%') AND ( FieldName NOT LIKE 'EXCL_%' )" & If ( $$omit_ea_fields; " AND ( FieldName NOT LIKE 'EA_%' )"; "" ); "|"; ¶; $table_occurrence_name )
*/

Omitting fields from all or particular tables without renaming to include the 'EXCL_' prefix
 
In the script "EasyAudit - Settings" add a global variable named $$fields_to_omit_all. This variable should include a list of fields that you want to omit from all tables (such as a admin field you have in all tables). E.g.
 

// List of fields to omit from all tables
List (
  "z_ModifyAccount_View";
  "z_ModifyName_View";
  "z_ModifyTs_View"
) 

In the script "EasyAudit - Settings" add a global variable named $$fields_to_omit_[table_name], where [table_name] is the base table name of a particular table you want to omit fields from. This variable should include a list of fields that you want to omit from the table [table_name] only. E.g.
 

// List of fields to omit from [table_name]
List (
  "Field1_To_Not_Log";
  "Field2_To_Not_Log"
)  

In the scripts "EasyAudit - Commit - Server" and "EasyAudit - Log Single Record - Server" Change the Set Variable ($fields) Step to the following calculation (this is the same as the change above with two additional lines in the list function): 

// Modified to allow excluding ea_fields when they have custom names

ExecuteSQL (
  "SELECT
    FieldName, FieldReps
  FROM
    FileMaker_Fields
  WHERE
    (
      TableName = ?
    )
  AND
    (
      FieldType NOT LIKE 'global%'
    )
  AND
    (
      FieldName NOT LIKE 'EXCL_%'
    )" &
    If (
      $$omit_ea_fields; 
        " AND
            (
              FieldName NOT IN
                ( '" &
                  Substitute (
                    List (
                      $$EA_UUID;
                      $$EA_Modifier;
                      $$EA_Mod_Timestamp;
                      $$EA_Mod_Count;
                      $$fields_to_omit_all;
                      Evaluate ( "$$fields_to_omit_" & $table_name )
                    ); ¶; "','"
                  ) & "'
                )
            )"
    );
  "|";
  ¶;
  $table_occurrence_name
)

// Original

/*
ExecuteSQL ( "SELECT FieldName, FieldReps FROM FileMaker_Fields WHERE ( TableName = ? ) AND ( FieldType NOT LIKE 'global%') AND ( FieldName NOT LIKE 'EXCL_%' )" & If ( $$omit_ea_fields; " AND ( FieldName NOT LIKE 'EA_%' )"; "" ); "|"; ¶; $table_occurrence_name )
*/ 
Link to comment
Share on other sites

This topic is 2924 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.