GTRR scripts in Servoy

Hi,

I use a lot of HTML-style hyperlinks in my FileMaker databases.
Whenever the user sees a blue underlined field, they can click on it and go to the relevant record in the database.

For example: If you are in a company database and click on a person’s name in a portal this will take you to that person’s record in the person database..

So I frequently do the following in FileMaker:

if(status(currentmode) <> 1) {
//check i’m not in Find Mode, otherwise it will not be posssible to do a find
Perform script(Related Database,Enter Browse Mode)
//GTRR does not work when related database is not in browse mode
Go To Related Record(RelationshipName,show)
//Shows only the related records
Perform script(Related Database,Go to some layout)
} else {
//i’m in find mode
Go to Field(The field I clicked on)
}

How do I script this in Servoy, the Servoy way?

I think its

forms.client_calls.controller.showRecords(client_data_to_client_calls);

where client_calls is the form you’re going to and the parenthesis describe the relationship

I’m new here too, but it works for me

Dave

Hi Dave,
thanks for pointing out that I have to specify the form I wan’t to go to, when using showRecords.

Just tried leaving my related form in Find-mode before trying the new script and it still worked. This will mean there will be less code to write than in FileMaker.

I still have a couple of issues:

  • According to the documentation there is no Servoy equivalent of status(currentMode). Is there any way of detecting Find mode?
  • If I attach the script to the onAction of an uneditable text field and I click on the textfield, the script does not get executed. If I attach it to onFocusGained it works, that will mean you the script get activated it you tab through the fields :-(

No en Textfield onAction only works if you can press the action key: Enter in that field.
If you make it non editable then that is not possible.

But why aren’t you using a button? Just as easy…

Since I’m using this user interface element a lot, I’m trying to avoid the workaround of putting a button on top of a field.

I have attached a screenshot.

In this case, clicking the link takes you to the record of the person. The round symbol is for editing the hyperlink. Clicking it takes you to separate screen which allows you to find and select people. This functionality was very easy to implement in Servoy :-) I use this technique since some of our databases may contain 10,000s of records. Using Filemaker value lists would be very slow.

In Find mode, you just click on the link-field and enter your search crieria, just like any other field.

We could make the field onAction behave the same as button onAction when not editable. (when doing find it is possible to enter data in not editable field)
Not sure if all other solution developers whould agree with this behaviour…

Is it possible to subclass Textfield to change the behaviour?

you can use the onFocusGained property to get the behaviour you want (we just realized)
-when in edit mode and the field is not editable onFocusGained method is still called when clicking on the field
-when in find mode the field is always editable en no events are fired.

I tried this, but if you tab through the fields, a non-editable field will gain focus and trigger the hyperlink…

That is why I would like to use onAction. The user should click on the field to to traverse the link.

onAction method will also be called now on a mouseClick inside a textfield that is not editable (will be in 1.2 final)

Great! :D