lesterd Posted December 4, 2013 Posted December 4, 2013 I Have a script that searches a relational database for information. The information it searches is in a calculation field. Each person in the relational database would have seven records with a calculation code Here are is an example for one person: ID Name Code (Calculation) 12345 John Jones 222-21-17 12345 John Jones 726-19-17 12345 John Jones 890-56-17 12345 John Jones 154-22-17 12345 John Jones 276-03-17 12345 John Jones 272-09-17 12345 John Jones 999-99-17 When I want to find all the people in the database that have the same code, it finds the right data but always shows the code for the first item in the records. In other words when I ask to see all the people with the 276-03-17 code, it returns the correct data, but the data in code box defaults to whatever code is in the first record for the person. In this person’s case the box reads 222-21-17. How do I get the data box to read the correct information that has been requested?
bruceR Posted December 4, 2013 Posted December 4, 2013 Your question cannot be answered without more information. Please upload your file or at least a copy of your script.
LaRetta Posted December 4, 2013 Posted December 4, 2013 (edited) I Have a script that searches a relational database for information. ... it finds the right data but always shows the code for the first item in the records. How do I get the data box to read the correct information that has been requested? Hi Lester, When you search a related table, the record set returned are people (in the current table) who have same code but what shows in the portal is ALL related records to that person based upon the existing relationship defined which is simple join by person. If you wish to restrict a portal down to only show according to the single code you define then you need alternate technique (filter the relationship or filter the portal) so it restricts related records to the code you specify. I do not have enough information at this point to advise which to use (and seeing your script would not help here) but you can filter the portal directly. If your Users enter their code request into a global field then the filter on the portal can be: not IsEmpty ( parentTable::global ) and portalTable::Code = parentTable::global OR IsEmpty ( parentTable::global ) There is good possibility that you will need your search script to end with a Refresh Window[] to update the results. So, depending upon your process, you can place a global text above the portal and attach a script trigger which fires OnObjectExit. If this related table holds a lot of records then the portal filter might be too slow so you would want filtered relationship instead. If you have questions or want a relational filter instead, just let us know and we can help you through it. :-) Please update your profile to your current FM version. If version 6 then filtered portals will not work. Also, you do not specifically show a portal in place; you need to use a portal. If you place a single field on the layout then it will only show the first related record. Edited December 4, 2013 by LaRetta
Recommended Posts
This topic is 4006 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