Jump 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.

Featured Replies

Question from another forum

"Does anyone have any example of a button from one database that will go to the same record in another database with the same ID. But I need it to first search all the records in the second database so that if there are multiple records with that ID it will show them.. if not then create a new record and set the ID field to what the ID field is in the first database. I have tried 100 different ways and can't get it to work correctly.

Thanks,"

See attached screen shots

ScreenShot for Find or Add Script.zip

Hi Robert,

You could set your button in your first database to copy the ID from the field then perform external script in DB 2 lets call it Find_Or_Create

The Find_Or_Create Script would go something like this

Enter Find Mode []

Paste [select, "YourIDField"]

Perform Find [Replace Found Set]

If ["Status( CurrentFoundCount) > 0"]

Go to Layout [LayoutDisplayingSearchResults]

Else

New Record/Request

Paste [select, "YourIDField"]

End If

This should work but I have not tested it so may need tweaking slightly.

The only problem I can forsee is when no records are found it will show the relevant message, you would have to click to continue for the new record to be created. You could proably get around this though by adding a step - if Status(CurrentError) = 401 then do something.

Hope this helps

Ed.

OK, so I didn't look at the screen prints before I replied! Looks a bit more complicated than this. I will actually look at the attachments now!

Ed.

I'd go with a relationship here from file A to file B....

Main Script.

If (IsValid::your relationship)

Go to Layout with Portal

Else

SetField(g_NewID, ID)

Perform External script

Refresh

External Script

SetField (g_ID, ???:Constant:g_NewID)

New Record

SetField (ID, g_ID)

  • Author

Right Ugo I agree , but I had an old file that I did in in and it was eaaier

just to take screens. Lazy I guess.

Robert,

Are you saying the quotes were from another user on another Forum and this was your answer ?

Sorry about that then. At least I'm not worried anymore...???

Hmm..

If that member was a man, I'm OK with this. If it was a girl, you're not a GentleMan grin.gif

What a Pain with Find mode this seems to me...

At least it works perfectly I assume

  • Author

Believe or not it is old Tech but still works perfectly.

I had no doubt Chopper.

Replace "At least it works perfectly I assume" with "I have no doubt it works perfectly" (Labguage barriers...).

I was concerned and worried YOU'd asked for help on this one. Glad you weren't in trouble wink.gif

I've attached a small example solution for this that basically uses the IsValid(ID | File2_ID::Constant) test. From there you branch to either displaying matching records, or creating a new related record. It's really easy to set up this kind of scripted process without having to perform any finds.

If you have any questions about the example files, email me smile.gif

Match_or_Create.zip

Is this sample done with FM 6.0 ?

I can't get it to work on 5.5 as there are some steps missing in the script.

But Yes, from what you're describing, either IsValid or not IsEmpty would be easier.

As Robert already pointed though, he just was lazy.... wink.gif

Hi Ugo,

Yep, it's in 6

Ugo ...

Yes, sorry, it's in FM6. I don't even think to develop in 5.5 anymore.

I'd send you a runtime version, but if you wanted to examine the scripts, you'd still be limited by 5.5.

Create an account or sign in to comment

Important Information

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

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.