Jump to content

Newbie: Create New Field in tab ?

Recommended Posts

Good afternoon/evening,

I have found a script which looks similar to the functionality I'd like to embed into a tab in my database, but it's not "quite" functioning correctly.

What I'm hoping to achieve is to have a field I can enter comments into, and then a button which when pressed, creates a new field. The idea is to keep every comment in a seperate field for ease of reference later. 

Pressing the button "New Comment" also creates the date to the left-hand side (would be nice to also add the current time), and also the "Delete Field" button to the right.

This is the script I discovered - but as you'll understand (better than I do), it doesn't create a new field, but does create a new record each time.

# save the current customer ID
Set Variable [ $customer ID ; Value: Dashboard::ID # ]

# Go to Communication Log tab and Create New Record
Go to Layout ["Dashboard" (Dashboard) ; Animation: None ]
New Record/Request

# Set Field to enter the comment into
Set Field By Name [ Comments::NewComment ; ]

# Go back to my original staring point
Go to Layout [ original layout ; Animation: None ]



Any guidance to modify the existing script would be very much appreciated.




Link to post
Share on other sites
2 hours ago, St3v1e said:

a button which when pressed, creates a new field.

That is not possible. Fields cannot be created programmatically. Nor would you want to have it that way: just imagine what it would take to find a comment in a cluster of fields of unknown size. 

The correct approach is to create a new record in a related table for each comment. And there you can easily have another field for the creation timestamp (or separate fields for date and time, if you prefer).


Link to post
Share on other sites

I'm not really understanding this situation but I do get the idea of creating a new record and not a new field - thanks for outlining that.

However, I've created a relationship between 4 tables referencing 4 tabs in my layout - Contacts, Tab2, Tab3 & Comments. "Contacts" is the primary key, and all the others are linked back as ForeignKey's.

When the "New Comment" button is set to activate the script (which I now have working), I do indeed get a new record appear in the portal, but that's my "apparent" issue - every time I click "New Comment" it triggers a new record. 

I'm guessing it's to do with my layout referencing all 4 tables - and suspect that the "New Comment" button/record needs to show in another layout which only references the Comments table?

File attached.


Note Buyers Database (Rolodex) Updates copy.fmp12

Link to post
Share on other sites

A few notes, in no particular order:

Your layout shows records from the Comments table (and your portal show records from the current found set in the Comments table). That makes no sense. The layout needs to show records from the Contacts table (which you named ContactNames, for some reason), and the portal needs to show records from Comments.

You have the relationship between ContactNames and Comments defined to allow creation of records in Comments. That means you can create a new comments simply by typing into a field in the last (first empty) portal row and Filemaker will automatically make it related to the currently viewed contact. Since your script doesn't do anything other than create a new empty record, I don't see why you need it at all. A new empty portal row will always be there anyway.

In case you do want to use a script, you need to grab the contact's primary key in a variable, go to a layout of Comments, create a new record, set its foreign key to Contacts field to the variable, and come back to the original layout (the layout of Contacts with the portal to Comments).

Note that Set Field [ SomeTable::Somefield ], with no content specified, doesn't do anything (except generate an error).


Edited by comment
Link to post
Share on other sites
  • 2 weeks later...

Hi Comment,

Many thanks for the detailed reply - plenty of excellent guidelines there. 

Apologies also for the delay in getting back to you, but things have been very busy at work and I'm struggling to find a few hours here and there to work on this - however, this weekend is free so I'm hoping to put your advice into practice and get back to you if I have any further questions.


Link to post
Share on other sites
  • 2 weeks later...

Hi Comment, thanks for your help, spent the weekend trying to figure this out and think Im  90% there.

I'm sure I'll be back with more questions as this DB takes shape.

Appreciate your help and guidance.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Similar Content

    • By Thomas Sanguinetti
      Good day all,
      Issue -
      I have created the file Radio.fmp12, stored in the same networked location as my other filemaker files. (See attached 'Filemaker Files.png').
      I am however unable to open this file using a script as have previous done with my other files.
      When I open the Hosts window, all my other programs are displayed except for Radios.fmp12. (See attached 'Hosts.png')
      I attempted to open the file directly via its network path and filemaker alerted me that the file could not be found (See attached 'filepath.png')
      Please forgive me if i am missing something but i can open the file directly from the directory so i am baffled as to why the file cannot be found.
      Any help would be appreciated as I am somewhat of a beginner with Filemaker.
      Thank you in advance

    • By ggt667
      FM18P: What is best practice when it comes to importing data using JSON / ION? I usually use XSLT and FMPXMLRESULT for import, is there a similar way to do these imports of records into FileMaker?

      FM19S consideration: I guess the simplest way is to write something in ECMA or Swift that outputs the portable array as FMPXMLRESULT? As pr example
      curl -kL https://api.domain.tld > /opt/local/usecaseION2FMPXMLRESULT > /opt/FileMaker\ Server/Data/Documents/usecase.$(date).fmpxmlresult.xml But then again FileMaker 19 Server does not allow for XML imports?
    • By ggt667
      I have been running on 2 copies of the same license in my house, in the mean time I bought a 5 user VLA, how can I change the license in FileMaker 18?, when the trial expires I can simply click Browse and click on the cert file that came with the VLA.
    • By Clayton King
      First, I appreciate any help I can get as this project has been evolving over two years and, as these kinds of projects to, has become more involved and complicated over that time. I've posted related questions, but exploring other parts of my project. As I'm not a programmer, but a sort of user nerd, my inquisitive mind wants to learn, but sometimes simple concepts elude me. Feedback, both on the specific goal at hand as well as the project overall is always appreciated.
      Performers is one piece of a much larger project, but I'm trying to enhance the project and working on a piece at a time. 
      I'm sharing the entire project layout to provide some insight into how the parts fit together. The application is a booking management tool for performers, consisting is several tables as shown:

      Again my focus right now is the Performers table and how to use it in relation to the Gigs (and Gigs~Songs_Join) tables.
      There is a Gigs layout which is the hub for performances by one or more Performers. On that layout is summary information about a gig and a portal which shows which songs were performed and in what order (Set & Slot fields). The portal also includes a Performer Name. The assumption at this point is that up to 4 performers will do a given gig. This might change in the future, and could impact the below goals.
      Gigs~Songs_JOIN is a connecting table for Gigs, Performers, Songbook, Venues, Musicians, etc. Performers is a table of singers and includes fields for a serialized SingerID, name, area of speciality (Tenor, Baritone, etc.), etc., and additional fields for combinations of the same performers including: 
      Multi: checkbox-indicates this record is more than one performer
      PerformerName: calculated based on Multi: if NOT Multi, show performers Name, if Multi, show MultiName (below)
      Type: value list-is this a duet, trio, quarter, all, etc.
      MultiName: the description of this record (i.e., Duet-Clayton/Vicky)
      Other summary fields include:
      Total Gigs: count of gigs in which this person has performed
      Total Songs: count of songs this person has performed
      GigID: match field to Gigs~Songs_Join

      I have two goals, one related to the other. First, if the Performer record is checked Multi, I want to "attach" or "associate" individual singer(s) to the record (i.e., show what people are "included" in the MultiName). For example, MultiName=Duet-Clayton/Vicky, I want to show that Clayton and Vicky (each in separate records) are part of Duet-Clayton/Vicky.
      Second, ultimately on the Gigs layout, I want to show which Performer sang which song (currently works in the portal), but more importantly, show variable summary information (goal layout below) which changes for each Gig as to each Performer, how many songs they sang and the total amount of time they sang. The catch is, in the summary I don't want to show the Multi records, but instead increment individual singers. So, in the summary info with related portal records in the example below, rather than showing Clayton sang one song, Vicky sang one song and Duet:Clayton/Vicky sang one song, I want to show Clayton sang 2 songs and Vicky sang 2 songs. In summary info, Duet:Clayton/Vicky wouldn't appear. In other words, the summary would show how much time each person was singing.

       In the summary block of the Gig's layout, each of the above sets is a one-row portal filtered by set. I want to have the SINGER1,2,3,4 replaced with the actual Performer's name, and each band/portal show summary info for the appropriate singer. 
      Here is my relationship graph:

    • By ggt667
      For FileMaker hosted solution does anyone use $$VARIABLE for external data source? I'm able to make $$VARIABLE="file:filename" work, however $$VARIABLE="fmnet:/host/filename" does not.
      In my case this would be $$FM16S00CONTACT="fm16s00.domain.tld/contact" and $$FM18S00CONTACT="fm18s00.domain.tld/contact"
      This now works, however it's unclear to me what triggered this working. I have a startup script that sets the variables. I have configure the External Data Source with $$FM16S00CONTACT, and this works, however adding another data source does not work for now, I tried quitting FileMaker and relaunch.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.