Jump to content

Viewing selected record


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

Recommended Posts

I have created a two tab control: 'Job' and 'History of Work' on a layout displaying the customer. The 'History of Work' uses a portal to display list of jobs done, whereas the 'Job' displays fields from a record in the job table. At present the 'Job' displays the last job entered which is ok but I would also like to select a job in the portal and have the 'Job' tab become active and display the selected job information.

I can't seam to work out the last bit on displaying the selected job info.

Link to comment
Share on other sites

You'll need to give the Job tab an object name (via the Inspector palette), so you can use the Go to Object script step. You'll need a global field to store the selected job ID, and a relationship from this field to the Job table. You can keep your existing Job table occurrence (TO) in the relationship graph, but you'll make a new TO for this. The fields on the Job tab will be from the new TO.

Your script will be called from a button in your History portal, something like:

Set Field( global Job ID; related::job id)

Go to Object( "job tab" )

There's another slightly tricky part: what happens when you go to a different customer? You don't want to show job info from the previous record. I would suggest you set a layout script trigger to use the same script or a variation of it to control the global Job ID field.

Link to comment
Share on other sites

Thanks Fitch, I can't understand why I need to use a TO and global fields, I created a script that runs when a portal line is selected, it copies the job ID of the line clicked to a veriable, it then makes the 'Job' tab active, I was trying to use the variable (jod_ID) to display the correct record.

I take it that this method I was trying won't work.

Link to comment
Share on other sites

Thanks comment, can't see how thats helped me, sorry Ive tried to work out what is happening but perhaps I'm missing something

Link to comment
Share on other sites

I can't understand why I need to use a TO and global fields, I created a script that runs when a portal line is selected, it copies the job ID of the line clicked to a veriable, it then makes the 'Job' tab active, I was trying to use the variable (jod_ID) to display the correct record.

That's exactly what my file does (minus the tab control, which I understand you have working).

Link to comment
Share on other sites

That's exactly what my file does (minus the tab control, which I understand you have working).

Thats correct, but after the tab 'Job' is active, its not displaying the job information that was selected in the 'History of Work' tab, it still showing the last job entered. I'm not sure of the script to do this. The script I have written stores the correctly selected jobID in a variable when a job is selected in the 'History of Work' tab and then activates the 'Job' tab, that all works but I dont know how to pass that variable on to get it to update the 'Job' tab info.

I thought I was nearly there with the script I had created, until Fitch kindly suggested using a global field and table occurrence, I dont mind working through that method if that is the only way, it just seemed a lot of work.

I have a little understanding of scripting and FM, Im still trying to get my head around it properly.

Link to comment
Share on other sites

I thought I was nearly there with the script I had created, until Fitch kindly suggested using a global field and table occurrence, I dont mind working through that method if that is the only way, it just seemed a lot of work.

It's one way, not the only way. The other option is to use a filtered portal, as shown in my demo. If you place the filtered portal inside the Job tab, you'll be done.

Link to comment
Share on other sites

Well I must be missing something because the file I downloaded, 'ViewSelectedChild11', as I click in the different 'childs', they change blue to show their selected but the 'details' stay set for the first 'child' in the list. I assume the details for each 'child' should change.

Link to comment
Share on other sites

Ahrrrrr, thats what it is then, Its because I'm using v.12. I also have v.9 but the same problem. Whats so different between v.11 and v.12, or is it the conversation thats doing it.

Link to comment
Share on other sites

No problem comment, I worked through Fitch's option last night and have managed to get it to work. Wasn't that difficult in the end. Learnt a lot about TO's and why they are used, so very pleased about that.

Thanks guy's for you help, much appreciated.

Link to comment
Share on other sites

Glad you got it working. I like the filtered portal method though, and I would probably go that route in version 11 or higher. (You mentioned version 9 -- filtered portals were introduced in 11.) Michael's sample file converted to 12 with no issues for me.

Link to comment
Share on other sites

Michael's sample file converted to 12 with no issues for me.

Just downloaded it again and tried it in v.12 and it all works, so not sure what happened the first time. Thanks again guy's

Link to comment
Share on other sites

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