September 14, 201213 yr Hi there, does someone know is possible to count Layouts but per each Table separatly? So if You got table: "Car" which has layouts: Price_List, Model and Purchase And then table: "Contacts", with layouts: Contact_List and Contact_Profile Obvious that table "Car" has three layouts and "Contacts" has two...but can we figure out that in script which will make calculation of how many layouts are per certain table? Any help appreciated Thanks in advance
September 14, 201213 yr Using the Go to Layout (First, Next) script step and Get ( LayoutTableName ) function, you could set up a script that loops through all layouts, checks what table occurrence each layout is based on, and increments separate counter variables for each TO. Note that this would count layouts by table occurrence, not by table. Using repeating variables with an encoded table name ("$TOLayoutCount[Code ( Get ( LayoutTableName ) )]") may be helpful for storing the counts if your TO names are no longer than 80 characters. An alternate approach might be to: Build a return-delimited list of TO names on your scan through all layouts. Make a copy of that list with duplicates removed. For each TO name from the deduplicated list, count the number of layouts with ValueCount ( FilterValues ( $originalTOList ; $currentSearchTO ) ).
September 14, 201213 yr Automatic message This topic has been moved from "FileMaker Product Family → FileMaker Pro 12" to "Database Schema & Business Logic → Managing Scripts". The FileMaker Product Family >> FileMaker Pro 12 is intended for the discussion of the functions, features and tools that were new in FMP 12. All how-to question should be posted to a topic area that best matches the sprit of the problem. Many questions can fit into more then one area, but you only need to pick one, and go with it. If you have any questions about this action, please contact me through a private message. Lee
September 14, 201213 yr Here is one way using script (see attached fp7 file). It produces list as: Contacts: 3 Invoices: 2 ... etc and then sets a global text field with the list. If you need it in a different format let me know. UPDATE: file removed because it wasn't applicable. Edited September 14, 201213 yr by LaRetta
September 14, 201213 yr I confess to being a bit lazy in this script. I should probably put the loop within the loop. But since variables make life so easy, and since the number of loops ( layouts ) would/should be fairly small, I went the simple-to-interpret way ( I hope ). And I didn't need to wrap the Go To Layout [ num by calc ] with GetAsNumber() either. Geez, and also be sure to Set Variable [ $$result ; "" ] at the end. My apology. :idot: Edited September 14, 201213 yr by LaRetta
September 14, 201213 yr LaRetta, I didn't look at your file, but I'm assuming it is listing layouts based on associated TO, not base table. If you wanted to list layouts by base table name, you could use this custom function: http://www.fmfunctions.com/functions_display_record.php?functionId=328 (FM12, or an SQL plug-in required)
Create an account or sign in to comment