Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 6901 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted (edited)

I need a script to select a primary key value on one layout, and paste it into a join record on another, in a field that is a pop-up menu.

In context one table is for Presenters, another books Presenters to take adverts, whilst a final layout details each advert. Rather than have to search through hundreds of Presenters on the join record, I want to use a button on the presenters page to open a booking record and paste the name in.

I'm sure there is a simple answer to this on but can't find and answer on the forum.

Advise appreciated.

script.jpg

Edited by Guest
Posted

Why use copy/paste? It destroy whatever the user had on the clipboard and FM has so many other ways of passing data around that it's really not needed.

Have a look at the "Set Field" script step. Since you already have a variable set to what you want as the target field value, just set the target field to the value of the variable...

  • 2 weeks later...
Posted

opps, didn't realise this had been replied to. I'm still struggling a little with this. How do I set the target field to the value of a filed on another layout. I have tried putting "Presenters::PresenterID" in the calculation field, but just pastes "Presenters::PresenterID" in the find field.

I want to the script take the value from the field, in the record that the button is pressed in.

Posted

Hi Dan

As Wim said you can use the set field script step to achieve what you want. The advantages are that you do not need to be on a layout that contains the field that you want to set and you do not need to use the clipboard.

eg to set a field in a new record from a field in an existing record, go to the record that you wish to transfer data out of then:

set variable (your variable;source field)

create new record

set field ( target field;your variable)

That should do it

HTH

Phil

Posted

As an after thought I just noticed that the heading to this question mentions a pop up menu. Why do you need to give the user a menu if you are auto filling the field ?

Phil

Posted

Great got that working and also using it for a script to edit records from a portal i.e

Select a record in the portal, set its id as the variable, switch to the full record view, enter search mode and setfield to the variable.

One problem, I have to manually press the return key, this is also the case to the booking script I was previously trying to get working.

Is there a way to script a return?

Also have tried using the perform find script step, setting "Find records when" to the field I need to query and the "Criteria" to $variable. When I run the script I get $variable in the search field not the variable.

Appreciate your help

Daniel

Posted

Phil,

The record is auto filled, if the user books from an individuals record, they can manually find an individual on the booking page, if they need to.

The other reason is to prevent changes being made manually to the name, I can't work out a way to lock the field and allow data to be writen to it from the variable.

Thanks

Daniel

Posted

Select a record in the portal, set its id as the variable, switch to the full record view, enter search mode and setfield to the variable.

One problem, I have to manually press the return key, this is also the case to the booking script I was previously trying to get working.

Is there a way to script a return?

Daniel

Dan

I am not working in 8 so I do not have the 'find record when...' option but in earlier versions, at the point at which you press return in find mode, a simple 'perform find' step would do the equivelant of pressing return

Phil

Posted

Phil

Think I was just trying to be a bit to clever, setting up the variables, just put the script step in unchanged and there we go,

Thanks for the help.

Daniel

This topic is 6901 days old. Please don't post here. Open a new topic instead.

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
×
×
  • Create New...

Important Information

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