Software Venture Consulting

FileMaker Pro downloads & Resources
FileMaker Custom Functions
FileMaker Web Viewer Examples
FileMaker Pro & Lasso Consulting
Training
FileMaker Books
FileMaker Articles
FileMaker Error Reference

Free Web Tools
Free FileMaker Tools

Personal Pages
Videos
Adventures
Links

Shopping Cart
Shopping Cart

Search:

Free Newsletter
Signup


Contact


Privacy Policy



FileMaker is a registered trademark of FileMaker, Inc. in the U.S. and other countries.

 

 FileMaker Pro Custom Functions

List  |  Show Random  |  Upload  |  Add This to Your Site

filterLines(filterField;filterValue;Result)

Rate this function:  

RatingRatingRatingRatingRating
  Average rating: 4.5  (31 votes)
  Discuss this Custom Function

Rob Atkinson, Webwyz Systems
http://www.webwyzsystems.com

Examines a list of values, removing lines that do not contain a given filter value.

Sample Input:
filterLines(
"Joe Smith BC 95
Fred Jones AB 96
Gail Peters NB 98
Herb Gardner SK 95";
"95";
"")
Sample Output:
Joe Smith BC 95
Herb Gardner SK 95


 Then copy & paste into FileMaker Advanced's Edit Custom Function window.

Click here to copy To Clip Manager if you have myFMbutler's Clip Manager installed

Description:

Many solutions have a field where a log is written line by line - for revisions, modifications, etc. Usually a carriage return is used to separate each line.
As the system ages, records can end up with a single field containing hundreds of log entries - detailing a wide variety of information.
Use filterLines to recursively search a text field, line by line for a given value. Only lines containing that value is returned.
Each line must be separated by a carriage return(ΒΆ).

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

This is my Custom Function and I want to edit it

Discuss:

Can also be written as:

/*
filterLines( filterField; filterValue )
*/

Case( IsEmpty( filterField );"" ;

Let ([
numValues = ValueCount( filterField );
topValue=LeftValues ( filterField; 1 );
match=Case(PatternCount(topValue; filterValue); topValue);
remainValues=RightValues( filterField; numValues-1)];

match & filterLines( remainValues; filterValue)
)
)

Bruce Robertson, Redmond WA
January 14, 2012 6:43pm

Thanks Bruce! Much neater and more concise.

Rob Atkinson, Vancouver
January 15, 2012 11:13am

If you have a really long log, you might run into the recursion limits doing this (10,000). Thus, it might be better to take a page from the Unix grep utility and do this line by line. That is, use a script to:

-- put the lines in a variable
- iterate through the lines
- for each line, if a match copy the line to an output variable
- return the output variable

Derek Bastille, Fairbanks, AK
January 17, 2012 6:36pm

You are right Derek - I should have pointed this out. The function isn't suitable as a "real" log parser. I originally proposed something similar to your solution to my client.

The client didn't like that because it wasn't dynamic. Every record you had to run the script..every time you looked at the log.

The client was saving the username, along with what was modified in a field. They had thousands of records containing 0 to 500 revisions.
They just wanted to be able to enter a username and see what they had changed.
However, you point out an important limitation.

Rob Atkinson, Vancouver, B.C.
January 18, 2012 7:51am

Make a comment about this Custom Function (please try to keep it brief & to the point). Anyone can post:

Your Name:
City/Location:
Comment:
characters left. If you paste in more than 1500 characters, it will be truncated. Discuss the function - advertisements and other useless posts will be deleted.
Answer 8 + 9 =
Search for Custom Functions:

Custom Functions Widget
Download the Custom Function Dashboard Widget for OS X
Keep all the latest Custom Functions right at your fingertips!

Newest Custom Functions:

1. decFromHex ( hexValue )
  (Mon, Oct 16, 12:34pm)
2. MonthYearList ( startmonth ; startyear ; numbermonth ; short )
  (Mon, Oct 16, 3:38am)
3. ErrorDescription ( errorNumber )
  (Wed, Sep 27, 2:51am)
4. decodeEntities (text)
  (Wed, Sep 27, 1:22am)
5. HexidecimalToNumber ( HexidecimalValue ; counter )
  (Mon, Sep 25, 12:39pm)
6. FixedFieldConverter ( Fieldname ; f1 ; f2 ; f3 ; f4 ; f5 ; f6 ; f7 ; f8 ; f9 ; f10 ; f11 ; f12 ; f13 ; f14 ; f15 ; f16 ; f17 ; f18 ; f1
  (Fri, Sep 15, 12:34pm)
7. ShannonEntropy ( text )
  (Thu, Sep 07, 5:59am)
8. LetterCount ( text ; summary )
  (Thu, Sep 07, 5:53am)

RSS Feed of Custom Functions