![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Here's a good one for the group, cause it's kind of tough. Let's say I've got a database with two tables, one called Contacts and one called Categories. Categories is used to categorize contacts, so the user can make as many categories as he wants and assign as many contacts as he wants -- a many-to-many relation where the contact pk (a field called IDC) is stored in a list in Categories (a field called IDCs) through a relation we'll call CIDC_GIDCs (that is, the Contact IDC field to the Category IDCs field). My client wants to be able to send lists of contacts to people without access to the database using Excel so recipients can manipulate the data however they need. There's no problem doing this. However, she wants to include the categories for each contact in columns so that the rows can be sorted and compared by category. In other words, she wants an Excel list that might look something like this: snip It's a great script, but takes forever. The client has a very fast setup, but it takes about a minute per contact record. That's a hell of a long time! Roughly speaking, it works like this: snip |
)
#3
| |||
| |||
|
#4
| |||
| |||
|
|
With respect to looping, I didn't realize that it would take more time to loop through each record and set each field rather than set each field and loop through the records, though I can see how this could be the case. But is looping definitely more processor-intensive? For instance, taking the Word example, if you do a find/replace on a document with a hundred carriage returns or one carriage return, it's all the same to the application, all other things being equal. |
#5
| |||
| |||
|
#6
| |||
| |||
|
|
Hi, Harry - snip With respect to the idea of a calculation, I was kind of puzzling over that when I was writing my post because it seemed like it would save all that time the script runs, but I wonder if there aren't a couple problems here. If I understand correctly, I'd define each of the generic category fields as a calculation versus, as I have it now, an empty text field that's filled by the script. The calculation would essentially be: for Cat1, the first category; for Cat2, the second, etc., but only if those categories are assigned to the record; otherwise leave it blank. So my first concern is that the Contacts table has about 50,000 records and the Categories table has about 50. These will continue to grow, but that gives you a sense of the magnitude -- in other words, the Contacts table isn't a hundred records, but it's not a million either. If a new category is added, it shifts the other categories, because the relationship CIDC_GIDCs is alphabetical, since my client wants the category columns in the spreadsheet to line up alphabetically. I didn't mention this in my post, and in fact my example doesn't demonstrate it, but it's one of the factors. So if a new category is added, but none of the Cat fields are being displayed and the calculation is set not to be stored, does the database take any kind of performance hit at all? Or will it only perform the calculations at the moment it gets ready to display/export them? |
|
The other challenge -- this is more fundamental -- is let's say the client wants to export a list that in total uses about 10 categories, but one of the categories is toward the end of the list. In that case there'll be 40 empty columns interspersed among the columns with data. And in order to clean up the document, they'd have to scroll through all the columns horizontally _and_ vertically to see whether any given column has data in it somewhere along the way. Then they'd have to delete each of the 40 columns that wasn't being used. This is different from my script, which always only uses as many columns as are necessary and puts them right next to each other. |
)
#7
| |||
| |||
|
#8
| |||
| |||
|
|
Thanks for that info. I wasn't suggesting that FileMaker and Word operate equivalently; only that we shouldn't confuse what something looks like on the frontend with what's happening on the backend. What does it mean to "open" a record? Is the database doing real processing when that happens? |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
Where do you get the info from? Sometimes I have specific questions about which processes are going to tax the database the most and haven't had that much luck finding technical info. Do you get it from FileMaker's knowledge base? Other forums? Thanks again for your help. |
![]() |
| Thread Tools | |
| Display Modes | |
| |