I need to provide the user a means to omit records and then to toggle back and forth between the two sets. For instance in a set of 10 records the user omits 2. They should now be able to toggle back and forth between the 2 and the 8.
The following code sets up such a process. The user can omit and then see the omits, but the original set is lost. Intuitively I need some means of storing these two sets. I’m looking at the getFoundSetDataProviderAsArray() function as a possible solution. Am I heading in the right direction?
Here’s the code as it stands:
var m = application.getLastKeyModifiers();
if ( (m & 1) == 1)
{
// shift key depressed
forms.comDetails.controller.loadOmittedRecords();
forms.comDetails.recordStatus();
}
else
{
currentcontroller.omitRecord();
}
jcompagner:
you could look at controller.duplicateRecord();
Duplicate record!?! I just want to toggle between two found sets.
Let the user omit records from the current set. Use the same button but this time with the shift key held to toggle to the omitted records. Then do it again to toggle back to original set minus the omits. Lets the user compare.
I did this all the time in FMP. Show Omitted in FMP will automatically toggle the user between two sets, but Servoy doesn’t (goes to zero records).
I’d like to impliment in Servoy a function FMP does easily – toggle back and forth between omitted records and the non-omitted. In a set of 10 records omit 3. Click a button to view the 3. Click the button again and view the 7. In other words, when viewing the 3, throw the 7 into the “omitted” bin.
The following code is the closest I’ve been able to work this out. However currentcontroller.omitRecord(foundset) isn’t functional, appears designed to omit only one record at a time.
var m = application.getLastKeyModifiers();
if ( (m & 1) == 1)
{
// shift key depressed
var original = forms.comDetails.controller.duplicateFoundSet();
forms.comDetails.controller.loadOmittedRecords();
var alternate = forms.comDetails.controller.duplicateFoundSet();
forms.comDetails.controller.loadRecords(original);
currentcontroller.omitRecord(foundset); // need to omit all currently displayed records
forms.comDetails.controller.loadRecords(alternate); // reload for display
}
else
{
currentcontroller.omitRecord();
}
Somewhere in the mix there s also the ‘invertRecords()’ function
Try the following :
Selectively omit 3 records from 10 (found set = 7)
Choose the Show Omitted records command (found set = 3)
Choose Invert Records (found set = 7)
Choose Invert Records (found set = 3)
Keep choosing Invert Records…
You will see that Invert Records acts as a toggle to swap the found set with those hidden/omitted !
This is great !!!
Problem is - let’s say you are at stage ‘4’ with a found set = 3 and you then, for whatever selection reason, omit another record so that found set = 2
Choose Show Omitted and it will give you a found set = 1
OR
Choose Invert Records and found set = 7
The new omit record command seems to create a new set of omitted records and does not add it to the original omitted group.
Also the Invert Records ignores this secondary omit command and gives you the original inversion of the original omitted record group !
Servoy Developer
Version R2 2.1.2-build 315
Java version 1.4.2-38 (Mac OS X)