filterLog ( )

Function stats

Average user rating
166
417
9999
Support
FileMaker 10.0 +
Date posted
18 January 2019
Last updated
18 January 2019
Version
Recursive function
No

Author Info
 Josh Ormond

3 functions

Average Rating None

author_avatar



 

Function overview

Prototype

filterLog  ( ultraLogField;   fieldName )


Parameters

ultraLogField  the field reference to the LogData field used by UltraLog.


fieldName  the name of the field to filter for. For example if looking for changes to the Price field, enter


Description

Tags:  UltraLog   filter   CustomList  

Return rows from the UltraLog LogData field for changes to a specific field.

Examples

Sample input

filterLog ( people::LogData ; "firstName" )


Sample output

1/3/2019    9:55:09 AM    jormond    firstName    L    -»    Luke
1/2/2019    3:01:47 PM    cdoe    firstName    Lucas    -»    L
1/2/2019    7:25:27 AM    ovale    firstName    [---]    -»    Lucas

 

Function code

/***************************************
*
*    Function Name:        filterLog ( logField ; field )
*    Parameters:        ultraLogField = Fully Qualified field name of the LogData field used by UltraLog.
*                    fieldName = the name of the field to filter for. For example if looking for changes to the Price field, enter "Price".
*
*    Dependencies:        CustomList ( ) custom function by Agnes Barouh. https://www.briandunning.com/cf/868
*
*    Purpose:            Return rows from the UltraLog LogData field for changes to a specific field.
*
*    Notes:            Special thanks to Nightwing Enterprises and Ray Cologon for releasing UltraLog.
*
*    Change log:        2019-01-02 Josh Ormond
*                        - Initial build.
*
*                    2019-01-17 Josh Ormond ( thank you Jerry Salem, Josh Willing, and Kevin Frank )
*                        - added a switch for when a space preceeds the field name in the log.
*                        - vertical list of fields in the UltraLog function generates an extra character in the log.
*                        - converted variables back to calculation variables, except as needed by Custom List.
*                        - cleaned up the local variables to avoid collisions outside of the function.
*
*****************************************/

Let (

[

theField = GetFieldName ( ultraLogField ) ;
$_ul_theLog = GetField ( theField ) ;
theSearchField = fieldName ;

$_ul_theSearch =
    Case (

        Position ( $_ul_theLog ; "    " & theSearchField & "    " ; 1 ; 1 ) > 0 ;
            "    " & theSearchField & "    " ;

            "     " & theSearchField & "    "
    
    ) ;

theValueCount = PatternCount ( $_ul_TheLog ; $_ul_theSearch ) ;

thePosString = Evaluate ( Quote ( "Position ( $_ul_theLog ; $_ul_theSearch ; 1 ; [n] )" ) ) ;
$_ul_pos = CustomList ( 1 ; theValueCount ; thePosString ) ;

theValuePositionString = Evaluate ( Quote ( "ValueCount ( Left ( $_ul_TheLog ; GetValue ( $_ul_pos ; [n] ) ) )" ) ) ;
$_ul_ValuePosition = CustomList ( 1 ; theValueCount ; theValuePositionString ) ;

theValueString = Evaluate ( Quote ( "GetValue ( $_ul_TheLog ; GetValue ( $_ul_ValuePosition ; [n] ) )" ) ) ;
theValue = CustomList ( 1 ; theValueCount ; theValueString ) ;


result = theValue ;

// Clean up the variables used for CustomList
$_ul_TheLog = "" ;
$_ul_theSearch = "" ;
$_ul_pos = "" ;
$_ul_ValuePosition = ""

] ;

result

)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/417

    Prototype: filterLog( ultraLogField; fieldName )
    Function Author: Josh Ormond (http://www.fmfunctions.com/mid/166)
    Last updated: 18 January 2019
    Version: 1.1

*/
// ===================================

 

Comments

Josh Ormond
22 February 2019



I have found that depending on how you list the fields using the UltraLog function, it will affect the characters used between the fields. If you find something not working, post a sample of the text you have in your log field, and I can make an adjustment to how the function works.
  General comment
Josh Ormond
22 February 2019



I have found that depending on how you list the fields using the UltraLog function, it will affect the characters used between the fields. If you find something not working, post a sample of the text you have in your log field, and I can make an adjustment to how the function works.
  General comment

 

 

 

 

 

Top Tags

Text Parsing  (33)
List  (32)
Date  (28)
XML  (27)
Format  (23)
Sql  (22)
Dev  (20)
Debug  (17)
Interface  (15)
Layout  (15)
Text  (14)
Variables  (13)
Filter  (12)
Layout Objects  (11)
Design  (10)
Array  (8)