Jump to content

Select Portal row and copy from field to another


mattlight

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

Recommended Posts

Quite simple me thinks, in fact I've never had a problem with this before until now.

I click on Client Name

It opens a new window and I FIND a client from a Portal list. The field ::ClientName from the portal window is a button that triggers a script to:

setfield ClientFound, FindClient::ClientName

What this does is copy the client name from the correct relationship name (FindClient) into a field called ClientFound which is used for another relationship to show client information in another window.

The problem is:

The portal window may show

Johnson Banks

John Malchavitch

etc

etc

If I click on John Malchavitch, it goes to the next window and sets the ClientFound field with Johnson Banks - and I can't work out why.

If there was a problem with the script or the portal, how would it pull the client name above the portal I row I selected - and it's nothing to do about accidentally clicking on the wrong portal row.

Any ideas?

confused.gif

Link to comment
Share on other sites

Instinct tells me you probably have a Commit Records/Requests step or you are doing something similar to switch focus from the portal before your Set Field step. It is probably easiest to Go to Related Record [show only related; yourrelationship] at the beginning of the script, so that the related record is isolated. Then you can go to that layout later and set the related ClientFound with the current (and only) found record's id.

If that option is not suitable, you can set a global with Get(PortalRowNumber) at the beginning of the script. When you are ready to set the field, Go to Field[FindClient::somefield], where somefield is a field in the portal (this shifts focus to the portal), then Go to Portal Row [by calculation; globalfield], and then reference the related field.

Link to comment
Share on other sites

Ah, i haven't used Commit Record - I had a problem before which needed a commit record and I nearly typed a note on my post to say that I hadn't used Commit record in case it had anything to do with the problem. But, it doesn't come up with the message I had with the other problem which was about "being modified in another window".

Supposedly, if I don't have a Commit Record script step, I can't modify a field displayed in the new window that is also open in the original window - but, it does - it inserts the top portal record contents.

Now the Get(PortalRowNumber) sounds like the solution but, I don't understand why I need to do that when I never have had to go to such lengths in the past. I will test out the portal row script step by placing the globalfield on the new window's layout and define a script that is triggered by the list of clients - click on each client in turn to see if it registers the correct portal row number.

But, If i do 'Go to Portal Row, Global Field' do i then, as the next script step, write setfield ClientFound, FindClient::ClientName to get the correct result? Is this what you mean about 'reference the related field'?

Thank you for your time and help

Link to comment
Share on other sites

Yes, when you are in a particular portal row, relationship::fieldX refers to fieldX of that row. So Set Field [ClientFound; FindClient::ClientName] will set ClientFound with the current row's ClientName.

If you are moving to a new window before setting the value, then it may be that the script is losing focus on the portal, in which case FindClient::ClientName refers to the first related record's ClientName, according to the sort order defined for the relationship, which is probably also the portal's sort order. This is why FindClient always contains the first related ClientName instead of one from another related record.

Link to comment
Share on other sites

This topic is 7008 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.