Insert text when new related field added filemaker 11 - filemaker

I have been tasked with adding some functionality to an old Filemaker 11 Database.
I have a table with a portal to a related field. Whenever an entry is added to the portal I am to insert some text into description field to prompt users to record some specific information related to that portal field.
I have set up some global variables to hold the required text and in the case of a normal field it is quite easy to trigger the text insert based on the value in a field. What I am having trouble figuring out is how to trigger the insert text based on the values in a portal.
Suggestions?

In general, you can insert a default value into a field by using the field's auto-enter options. If you want this to happen only upon record's creation, leave the Do not replace existing value (if any) option checked.
I did not understand this part:
how to trigger the insert text based on the values in a portal.
You need to explain how exactly the inserted text should be "based on the values in a portal".

Related

Filemaker Pro 14 History tables

With a few solutions Ive worked with I've created temp table's or history tables. Normally I script it to take a handful of fields needed from a main table and copy it over to the other table by
Setting a variable then setting field to the variable for each field in the new table / new record.
I have a situation now, where Im building a history table that needs to copy the current record as is. A snapshot where all fields from that instance of the record are copied to the history table.
Rather then setting a variable then set field to the variable, Id like to get some input on a quicker way to get this done where I can do this on a record level and not type out field by field to get it done. Also if fields are added to both tables then I have to make sure my script gets updated.
Ill keep hunting around.. appreciate any help.
-Rich
Do you have a sample of copying a record from 1 table to another
including all fields and setting some fields?
As I suggested in comments, use the Import Records[] script step, and select the same file as the source. If you choose Arrange by: [ matching names ] in the Import Field Mapping dialog, it will automatically map all source fields to their similarly named counterparts.
Note that you must establish a found set in the source table before importing.
For "setting some fields", you can define auto-enter options and activate them during the import, or run Replace Field Contents[] immediately after the import.

Hide elements in list view for non active records in Filemaker

I've got a list view of a number of records. I would want to hide certain layout elements on the records which isn't the active one. Is this possible?
It should be possible with the "Hide object when"-functionality, but I'm not sure what the calculation should be.
I'm using Filemaker 13.
You can use a Script Trigger to set a global variable (e.g., $$ID) with that record's Primary Key (ID) when a record is loaded, then hide the button/layout object if not $$ID = PKID.
Adapted from the technique at http://forums.filemaker.com/posts/e591b47fdc.
Just create a statistic field in your table that counts the current number of any field that is filled in every record. An ID or timestamp would be the best guess. Then hide your portal object(s) in the inspector with "YourFieldName" <> Get(ActiveRecordNumber). Should be done.

Invisible value when creating new record

I have problem with some form in Access 2010. In one of the fields (Amount) I have as a value expression =IIf([IsNull([Code]);1;2) . In the form the values 1 and 2 are shown correctly but when I try to save the newly created record I have an error: You have to fill the Amount field. Can someone tell me why the value is not visible when saving new record to database?
You need to use VBA code on the NewRecord and/or BeforeUpdate event to insert these values into this field/textbox. What you are doing here amounts to setting a value for Display only.

Access comboxbox selection needs to change value in label control

On a form, I have a combobox, with the RowSource coming from a query (specifically, a calculated field in the query). When the user makes a selection, I want to update a label on the same form with a different column from that same query, but of course associated to the selection.
I'm fine with VBA and writing queries and whatnot, but I am not very familiar with Access forms.
By the way, I tried searching for an answer to this, but it was quite difficult because I don't know what this thing is really called that I am trying to do. A good link to a site explaining this would be perfectly fine (no need to write a bunch of stuff here if it already exists elsewhere).
In the After Update event of my combo box, cboUserID, I can set a label control, lblFoo, to the value of the second column in the selected row of the combo.
Me.lblFoo.Caption = Me.cboUserID.Column(1)
If your combo box is bound to a field in the form's record source, you may want to do that same operation from the form's On Current event also.
You can use the column property to refer to anything other than the bound column of a combo.
Rowsource: SELECT ID, SName, FName FROM Table
Me.MyCombo.Column(2)
This would return FName.
-- http://msdn.microsoft.com/en-us/library/aa224084(v=office.11).aspx
Me.MyLabel.Caption = Me.MyCombo.Column(2)

renumbering a ID field

Very new to Filemaker. Using Filemaker 11 pro.
I was wondering if it was possible to renumber an ID field column after doing an insert new record in between records? Maybe using a script trigger?
thanks
I agree with Jesse that renumbering a record's unique ID/Index doesn't sound like a good idea and more information or an example of what you're trying to do would help.
If you simply want to display the Record Number, you could create an unstored calculation field with the calculation "Get ( RecordNumber )". This should always display which record, of the found set, is being displayed. FileMaker's definition is available here: http://www.filemaker.com/help/html/func_ref2.32.55.html
If, on the other hand, you're trying to make a unique sort order for the records being shown, it is best to do this by creating a new SortIndex numeric field. (You'd need to make certain that the layout that you're displaying was always sorted by the SortIndex field which can be done using layout script triggers and, possibly, overriding the Sort menu commands using Custom Menus.)
One method to consider would be overriding the New Record command using Custom Menus. When New Record is selected you might route it to a script which does something like this:
Get the current SortIndex value
Get the value of the SortIndex for the next record (by creating a self-join which shows records where the SortIndex > the SortIndex of the table occurrence your view is based on)
Place the average of those two values in a $variable
Create a new record and set its SortIndex to $variable