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.

Setting a variable

Featured Replies

Newbie.

OK, here goes...

• When I make a new entry into a portal, the cursor automatically enters a text field.
• This text field triggers a script. (or whenever I enter it)
• I had hoped that script would set a variable called "$$todo", with the value being the record's Primary Key, which i had thought it would have grabbed with the following script...
        Set Variable [$$todo; Value:GetField ( ToDo_Pk )]
• But I just get a "?"

So in other words, I'm trying to set a variable called "$$todo"... of the record that holds within it a text field I had entered. Obviously there is something wrong with my script, but I haven't got a clue what I'm doing wrong... is there anyone out there who can point me in the right direction?

I tried to embed some images, but it just isn't happening for some reason, all I'm seeing is an endless spinning icon.

 Thanks.
              
 

 

 

If you are in a portal, no need to use GetField().  Just use the related pk field reference directly (through the relationship)

  • Author

If you are in a portal, no need to use GetField().  Just use the related pk field reference directly (through the relationship)

​Thanks Wim, but its not working.

I guess you mean...

Set Variable [$$todo; Value:ToDo::ToDo_Pk

I've added a merged variable to my layout to see if it is pulling the value as I haven't got 'Filemaker Pro Advanced"... and it is just showing a question mark. Additionally other items that are looking to that variable to act aren't working.

The trigger works off... "OnObjectEnter" which I should have thought would have fired when I click into the text field?

Just a thought...
It says that the value of the variable must be text, but I'll pulling from the primary key which is a number, is that a problem?

 

Any ideas?

Edited by Karlos Fandango

can you post a screenshot of your layout in layout mode and of your script?

 

Text vs. Number: does not matter.  FM does a pretty good job at auto-casting data types.  If you want to be 100% certain that FM uses what you store in the variable as a number then wherever you use it do GatAsNumber( $$todo )

  • Author

can you post a screenshot of your layout in layout mode and of your script?

 

Text vs. Number: does not matter.  FM does a pretty good job at auto-casting data types.  If you want to be 100% certain that FM uses what you store in the variable as a number then wherever you use it do GatAsNumber( $$todo )

The portal is within a 'Tab Control', Now when I click on another tab and then return... the variable loads the right value. I added "commit record" to the script but then I couldn't edit the text field as it instantly committed, moving me to the next field.

I got it to work by using... GetValue

So its working, now I've just got to force it to work without having to leave the tab for another, then return.

I tried adding a link to an image on my google drive again, but it is hopeless... just get a spinning icon. But I here is a link to it on my drive...

https://drive.google.com/file/d/0B687aT8LAHKmbzRIaVNReVRENnM/view?usp=sharing

Where the "4" is, is where I added the merged variable <<$$todo>>

Edited by Karlos Fandango

That does not tell me much, it is in Browse mode...

​I've added a merged variable to my layout to see if it is pulling the value as I haven't got 'Filemaker Pro Advanced"

​That's not a good method of testing, because the layout may or (more likely) may not be refreshed . To make sure your script sets the variable correctly, have it show it to you in a custom dialog or set a field to the variable's value.

 

​Now when I click on another tab and then return... the variable loads the right value.

​That's just one more indication that the real problem is with the layout object, not with the script.

 

​I got it to work by using... GetValue

​That makes no sense.

 

Edited by comment

Karlos: I don't see why placing the image here would be a problem.

3.png

 

​That makes no sense.

 

Emphasizing this. Karlos; if you think you fixed it: you have not.  It just looks like it is fixed so if you having in there and show us your layout and your script we can help you fully understand what is going on.

  • Author

Emphasizing this. Karlos; if you think you fixed it: you have not.  It just looks like it is fixed so if you having in there and show us your layout and your script we can help you fully understand what is going on.

​Hi.

Acknowledging my failings in explanation I decided to do a short screencast, that done I uploaded it to my Google Drive, grabbed the link to view it only to find some three hours later Google still hasn't processed it. I'll now leave the link in the hope that it will be processed soon... either way it will be viewable eventually...

https://drive.google.com/file/d/0B687aT8LAHKmOWlfUXBSUVVXUHc/view?usp=sharing

I hope it goes some way in expounding my issue, better than my literary skills have.

Thanks, Karl.

  • Author

Finally I got it to work, unfortunately the video above does not play... I've had allot of trouble with Google Drive lately. But anyway, I've recorded another of my issue resolved...

https://drive.google.com/file/d/0B687aT8LAHKmMEpLaUI3dTYyUzQ/view?pli=1

I found that I could only watch the video if I changed it to 360p rather than the 480p it was trying to use.

 

 

Edited by Karlos Fandango

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.