In FileMaker, when there is a related field on a layout, or a portal, I am able to enter a value in a field. When there is no related record, FileMaker will create one, or if I enter something in the last empty row, also a record is automatically created. (The key field is set to the value of the key field from the current record).
When I try to do the same thing in Servoy I get an error saying: “No record, create one first”.
Also, there is no last empty row in a portal. So how is it done?
I enabled the option to allow the creation of new records in the relationships.
This confused me for a bit too, coming from a Filemaker background. The answer I came up with, which works just fine to my sample FM users, is a small button above the portal that executes a simple method which creates a new related record and automatically puts the cursor in the first field in the new row.
The core of the method couldn’t be much eaiser, in the client_data form:
elements.client_calls.newRecord();
where the form feeding the portal is the client.calls form
I saw another thread about the relative values of using portals or tabs. So far I’m staying largely with portals, though my development partner has gotten fond of tabs.
Hell, I could sit around all day and just drag the column headers back and forth in a portal! The ease of setting these up to display perfectly every time is amazing.
dave
I was thinking in that direction too, but when a user sees an empty tabpanel (because no related record present) he has no clue why it is empty and he could start typing in a randomly chosen field. I’m not sure how he would react on error messages even if there would be a button, saying ‘create new record’ or the like.
Maybe there is a way to trap the error and trigger a method?
I’m doing this strictly with portals. If the portal is empty, there are no rows for a user to deal with. A click of the button creates a row (at the top of the portal assuming rows already exist). I think it’s pretty intuitive thereafter for a user to figure he is supposed to do something there now.
I agree some error trapping of some kind is a good idea, haven’t really gotten that far with this particular issue yet. Right now all the fun involves figuring out how to do Finds that work as well as FM does (see new thread in Methods).
Really, this bit does give a very satisfactory new record experience to someone used to using Filemaker for awhile.
dave
The tabpanel is a somewhat more advanced feature not found in FMP, and needs some javascripting to get it working completly smooth for the enduser.
The following options are availeble:
-put the form on the tab in listview (can be seen in the crm sample solution for almost all use of tabpanels) until a button ‘create new record’ is pressed no record is shown.
-when you make a record in the main form you can disable the tab or hide entire tabpanel with javascript, until a button ‘create new record’ is pressed.
coming back to this. I really like this intuitive nature of FM portals, where the first empty row can be entered directly in the portal, without an “ADD RECORD” button/method. Have you cracked it yet?
I haven’t tried it yet, but what about creating an empty related portal row when a new parent record is created, and whenever a portal row is filled. That way, the last row will always be available for data entry.
You could have another method that deletes the empty row when moving off the parent record, for sake of tidiness.
Is there a better way>?
antonio:
coming back to this. I really like this intuitive nature of FM portals, where the first empty row can be entered directly in the portal, without an “ADD RECORD” button/method. Have you cracked it yet?
I haven’t tried it yet, but what about creating an empty related portal row when a new parent record is created, and whenever a portal row is filled. That way, the last row will always be available for data entry.
You could have another method that deletes the empty row when moving off the parent record, for sake of tidiness.
Is there a better way>?
Absolutely. ![Smile :-)]()
Your procedure causes the creation (and maybe the deletion) of potentially useless records.
Moreover, if you delete the empty row, you won’t have it available anymore, if you come back to this record.
And if you don’t delete it, you’ll end up with a ‘ghost’ related record
I personally don’t like that FM feature very much, since it’s not consistent with the other FM record creation methods; anyway, if you can’t live without it
, I would suggest to place some global fields on top of the portal, with an OnFocusLost Method that creates the actual line when the user leaves the last field (or a button, if you prefer to leave the user only complete certain fields).