I would love to see something as user-friendly and as useful as 2EMPower (but of course without the $395 (over)priced amount.
It never ceases to amaze me that a "development" product could be around for decades without a simple search/replace across scripts and CFs. Totally weird, IMHO.
name="EmployeeFirstName"
Trim ( Self )
name="EmployeeLastName"
Trim ( Self )
name="SocialSecurityNumber"
// validate this SSN
Let(
[
n = Filter(Self;"0123456789"); // get only the digits
...
Notes on how the XPATH command works:
-q means 'quiet' (suppresses non essential information)
-e means "use this xpath expression"
multiple -e commands are chained together in order by passing the resulting nodeSet from each command to the next one
//Field[descendant::Calculation]means "select any Field node that has a Calculation node as a descendant (one or more levels below)
// in a path is like a wildcard, so will select the node at any level, even if it has parents (it doesn't have to be the root node)
@name means print the 'name' attribute of the node (e.g. which is the name of your FileMaker Field name)
| is the bar or chain operator which allows you to select two disparate nodes at once
.//Calculation//Text/text() means 'if there is a Calculation node at any (at any level) which has a child Text node as a descendant, select it. The /text() means "print only the text value of the node"
So, at a high level, the xpath command does this:
Select any Field nodes that have a Calculation node within them
send this nodeset to a second level of processing.
In the second level of processing, print the name of the Field node (which is our Field name) and also print the contents of the Calculation's Text node (which contains the calculation formula)
I believe this will find most Calculations, including calculations used inside a field validation, auto-enter calculations, as well as normal calculated fields.
Edit to add:
To get the text of formulas for Custom Functions , use this script:
Nice work @xochi . Thank you for providing the detailed breakdown of the use of the xpath command. That is very helpful, and I appreciate you taking the time to break it down.
Nice. I keep a notebook of xpath snippets for re-use.
But getting exactly the right xpath/xquery can require a little bit of trial and error. For open ended browsing I use https://basex.org. It provides a variety of nice visualisation methods that can make it much easier to understand and work with the results.
I managed to get it figures out - I used BBEdit - when dealing with XML it gives you disclosure triangles so you can collapse sections, which makes it more manageable, but the baseX app looks quite nice.
On the layout you are really interested in the top level object but your search is for attributes. With BaseX you can simply step back to higher levels to display the ancestor object. It provides lots of different visual representations of the data, as well as plain text (similar to what you'd see on the command line).