Let’s assume that one may wish to find all records in a database. Opinions may vary on this in Servoyland, but let’s assume it is part of the spec.
After finding all records in a database, I want to be viewing the record that I was viewing before finding all, but with access to all other records by using navigational buttons. ‘Finding all’ does not mirror "Show All’ in the Select menu, however. "Finding all’ really means, e.g., finding all active records, then sorting by creation order descending.
In The Program That Shall Remain Nameless, one might do this:
set field (some_global) = primary_key
run subscript (find active and sort by date desc)
go to related record (based on some_global); do NOT show only related
It’s that last step that I can’t seem to accomplish in Servoy. Here’s what I have going on:
globals.id_temp = pk_contact
globals.statusfilter [which in this case finds all records marked ‘active’]
[to test one could substitute controller.loadAllRecords]
controller.sort(‘pk_contact desc’);
controller.showRecords(con_id_temp_to_contact);
Again, it’s that last step: how to go to related record without disturbing the new found set? Get/set index won’t do, as index is a moving target.
On a related note (pardon the pun ), in the Sample CRM solution, I can’t seem to be able to get to the related company from a contact (and vice-versa) ever since I imported more than 40 000 records in both tables. (I’m thinking the 200 record limit applies to ‘foundset.selectRecord(pk_id)’, or am I wrong again?) Anyway, how can I make sure that I end up on the correct record when coming from a related one? (Since I’m using the CRM demo as a reference, any pointers would be appreciated as to which one of the methods I should change.)
IT2Be:
When you did your import have you thought about keeping the same pk’s (I know stupid question but still)?
Actually, I created new records through Servoy’s import function, letting Servoy assign new pk’s. The company name was a field in the contact records, so I created a DEV relation using these fields. I then looped through each contact record, assign them the correct company_id through the DEV relation.
IT2Be:
Is the defined relation correct (again stupid question but you never know)?
The DEV one is, because a related tabpanel shows me the correct record(s). As for the second relation (from company_id in contacts to company_id in companies), it is also OK, since the correct company name appears when I assign the company_id in contacts.
As I said, this has to do with the Sample CRM solution, so I don’t know if there’s a specific onShow/onRecordSelect method I should modify for the behavior to work correctly…
As I said, this has to do with the Sample CRM solution, so I don’t know if there’s a specific onShow/onRecordSelect method I should modify for the behavior to work correctly…
Hmm, neither do I. I’m sorry but I hardly know anything about the current sample solution…
I started learning to use Servoy just a couple of months ago and decided to use the sample CRM as a demo for clients and quickly found the same problem when using more than the 200 record limit. Feedback from the Servoy staff was basically this is a sample only and only designed for less than 200 records and to show basic features - so beware!
Work around suggestions included not having two tab panels (one with a list and one with a detail view) using the same foundset etc! I was extremely disappointed.
After doing many long hours of searching this forum I did find some tips that through trial and error allowed the sample CRM to be useable with more than 200 records and the problem of jumping to a company from a contact and vice versa was fixed for most cases.
However the performance penalty is detracting the client from selecting Servoy as the solution. I shall probably have to redesign the CRM and not use the sample approach so as to give the impression that more than 200 records can be used with fast response!
My brute force method was to loop through every single record until I find the correct record (e.g. if using the search feature to find a record near the end of the database when only the first 200 have been loaded).
I had hoped that there would be a “tip” area in the forum that could be maintained as versions are improved to show me example code of selecting a record not in the current 200 limit.
I would be glad to hear from the “experts” in how to deal with such matters as perhaps other “newbies” might be.