Skip to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Script to create new related but not in portal

Featured Replies

Can someone point me in the right direction for this.

I have a database with 562 records in it and I want to enable the web companion so that people can log in from a web browser and see only about 23 of those records in form view. The 23 records that I want them to be able to see are for a winter tour coming up. I only want them to be able to see them as a report and not be able to search or enter any data (I can figure that part out). I can create a flag field for marking the records that I want displayed but I am not sure where to go from there. I also want the number of records shown to be dynamic based on whether or not I flag them. It seems to me that the best way to do this is to create a related database that has just the fields that I want them to see and have a script so that when I flag a record in the original database it automatically creates a new related record with the correct data in the correct fields in the related database that can then be served up over the web companion but I am not sure how to go about this. I mean, I know how to create a relationship but I am not sure about how to make a script that would create a new record in the related(web) database whenever I flag a record in the original database.

Please help.

Ronzues

It's been forever since I used web companion, but can't you, when you're setting up your Find screen, select a "canned" find? If so, just have it find all the flagged records.

  • Author

I am not sure that I can do that or if I can I am not sure how. I have never seen that option. I did however try to create a script and a layout with a button on it that would find the flagged records but the button did not work in a web browser for some reason and I tried it on several platforms and several different web browsers.

Suggestions?

OK. First make sure that you have some sort of unique ID for each record in your main database (an auto-enter serial number will work fine).

In your relalted database (Web.fp5) create a field called MainID (make sure it's the same type as the ID field in your main database).

Create a relationship in Web.fp5 back to Main.fp5. You'll use the MainID field in Web.fp5 to relate to the ID field in Main.fp5.

For whatever fields in Main.fp5 you're wanting to mirror in Web.fp5, create a corresponding field in Web.fp5 (you've probably already done this). Create each field to auto enter it's "parent's" field value (the corresponding field value in Main.fp5) based on a lookup that uses the relationship you defined above.

In the main database, create a global text field, gID.

Create a button in Main.fp5 that calls the following script:

Set Field [gID, ID]

Perform Script [external]

Exit Record/Request

Halt

The eternal script that is called lives in Web.fp5 and looks like this:

New Record/Request

Set Field [MainID, Relationship::gID]

Exit Record/Request

One thing to consider - because this solution uses lookups, any changes to the data in Main.fp5 will not be reflected in Web.fp5 without performing a relookup.

Okay. I've never done web sharing with FM on either platform so I can't specifically address that. However, I do know that you can create a script that will perform a find and have it run that script at startup of the db. Wouldn't there be a similar function (i.e. to have a script run automatically) when the db is opened via the web? If so, then you can manually perform the find, create a script to go to whichever layout you need to display via the browser, perform the find without a dialogue box and viola.

I'm sure the related file would work but I think it's just a lot of work to go through to get it done and, as John pointed out, the maintenance of that related file (since it is actually a lookup not a true related file) would be tedious.

Hi Angelo,

The db isn't opened by the browser. The db is assumed to be open before the browser interacts with it. You can run scripts via the browser, but I'm not sure you can do that with Instant Web Publishing.

I think the easiest (though certainly not the most user-friendly) way would be to have the web user search the db for the records that have been flagged.

John,

I'd have to agree. Maybe the "published" page is just an intro type page and the button (or whatever) that the user clicks on to "enter" the site would perform the find.

Is that what you were thinking too?

That would work fine, but like I said, I'm not sure that can be done with Instant Web Publishing. I know it can be done if you go the CDML route.

  • Author

Thanks to all,

John, your info is what I think I needed. I had already created a related file and had already assigned ID's to auto-enter in the main file, then I created a relationship between the main file and the web file based on the ID but instead of using lookups I just used the related fields. That way I could create a new record in the main database and then go to the web database and input the same ID number manually and all of the fields would be filled in for me. That would have worked but I wanted the web file to be updated automatically or by the push of a button instead on me having to go to the file and enter the correct ID number to create a new record. I think what you gave me above will solve that.

The reason that I want a seperate file altogether is because I only want people from the web to see certain records(the ones that are marked for the winter tour)and only certain fields. A related database accomplishes that.

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.