jdenver Posted May 24, 2012 Posted May 24, 2012 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.
Fitch Posted May 24, 2012 Posted May 24, 2012 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.
jdenver Posted May 25, 2012 Author Posted May 25, 2012 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.
comment Posted May 25, 2012 Posted May 25, 2012 See if this helps: http://fmforums.com/forum/topic/71867-getting-more-out-of-filtered-portals-2view-selected-child/
jdenver Posted May 25, 2012 Author Posted May 25, 2012 Thanks comment, can't see how thats helped me, sorry Ive tried to work out what is happening but perhaps I'm missing something
comment Posted May 25, 2012 Posted May 25, 2012 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).
jdenver Posted May 26, 2012 Author Posted May 26, 2012 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.
comment Posted May 26, 2012 Posted May 26, 2012 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.
jdenver Posted May 26, 2012 Author Posted May 26, 2012 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.
comment Posted May 26, 2012 Posted May 26, 2012 I assume the details for each 'child' should change. They most definitely should. I haven't installed v.12 yet - perhaps there's some issue with the conversion?
jdenver Posted May 26, 2012 Author Posted May 26, 2012 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.
comment Posted May 26, 2012 Posted May 26, 2012 I don't know. I see no reason why it wouldn't work in v.12 and I wouldn't want to jump to any conclusions.
jdenver Posted May 27, 2012 Author Posted May 27, 2012 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.
Fitch Posted May 29, 2012 Posted May 29, 2012 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.
jdenver Posted May 29, 2012 Author Posted May 29, 2012 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
Recommended Posts
This topic is 4629 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 accountSign in
Already have an account? Sign in here.
Sign In Now