April 12, 201510 yr Hi all, I have portal which points to a table with an x relationship, so that all records are visible in the portal. Clicking on a portal hilights the row by invoking this script: SetField [trig_hilite, Get ( ScriptParameter )] where trig_hilite is a global number field and the script parameter is the ID of the record in the clicked row. Now that these two fields match, I can use a conditional format to hilite the clicked row. Works nicely, but if course there's always another level I want to go to. I'd like to recycle this script for other tables rather than making modified duplicates. It seems that modifying the script with an additional script parameter should allow me to capture the field I clicked on like this: [SetFieldByName (GetValue ( Get ( ScriptParameter ) ; 1 ), GetValue ( Get ( ScriptParameter ) ; 2)] The parameters I am passing to the script right currently look like this: "Table_A::trig_hilite¶Table_A::ID_record" But this does not work. How can I pass both the field name I want to modify and the value I want to set? Thanks, Stefan
April 12, 201510 yr The parameters I am passing to the script right currently look like this: "Table_A::trig_hilite¶Table_A::ID_record" But this does not work. Is that the formula you are using for the script parameter? Why is it in quotes? It seems to me your script parameter needs to be = GetFieldName ( Table_A::trig_hilite ) & ¶ & Table_A::ID_record It would be easier to advise if you had described what actually happens, instead of just "this does not work". I'd like to recycle this script for other tables rather than making modified duplicates. Well, if you're looking for a real challenge, how about using just one global field for all tables? In fact, why don't you use a global variable (or variables, since they do need to be defined beforehand in the file's schema) for this?
April 13, 201510 yr Author Is that the formula you are using for the script parameter? Why is it in quotes? It seems to me your script parameter needs to be = It would be easier to advise if you had described what actually happens, instead of just "this does not work". Well, if you're looking for a real challenge, how about using just one global field for all tables? In fact, why don't you use a global variable (or variables, since they do need to be defined beforehand in the file's schema) for this? Well exactly. It now works. I was wondering about the quotes myself, but I swiped some code from a similar (working) script, and obviously it wasn't similar enough. As for the real challenge... well, I'm already challenged as it is. But perhaps you were anticipating my next question which would be 'do I really need a 'trig_hilite' field in every table? I thought about just using one global field, but if I view the previous table (say in a tab panel), then the highlight would be gone, unless I come up with a (probably very complicated) way to trace my steps somehow. I don't think that using a global variable would work, since my tables are in a different file (this is a dirty separation model). Thanks, Stefan
April 13, 201510 yr I thought about just using one global field, but if I view the previous table (say in a tab panel), then the highlight would be gone, unless I come up with a (probably very complicated) way to trace my steps somehow. Well, what if the global field contained something like: Table_A:14 Table_C:21 Then your script's job would be to see if the current table's name is already in there; if yes, then replace the number following it with the clicked record's ID; otherwise add a new value with the current table's name, followed by the clicked record's ID.
April 13, 201510 yr Author Well, what if the global field contained something like: Table_A:14 Table_C:21 Then your script's job would be to see if the current table's name is already in there; if yes, then replace the number following it with the clicked record's ID; otherwise add a new value with the current table's name, followed by the clicked record's ID. But how does the relationship know which value in that return-delimited list is the correct one to use? Can I have partial contents of a field being a match field?
April 13, 201510 yr The relationship looks at the entire field; the highlighting calculation checks if the field contains a value that matches the current table's name and the record's serial ID - something like (untested) = not IsEmpty ( FilterValues ( Get ( LayoutTableName ) & ":" & SerialID ; gField ) )
April 13, 201510 yr Author The relationship looks at the entire field; the highlighting calculation checks if the field contains a value that matches the current table's name and the record's serial ID - something like (untested) = not IsEmpty ( FilterValues ( Get ( LayoutTableName ) & ":" & SerialID ; gField ) ) Ah, here comes the challenge. Would I need to duplicate each line in the global for each table occurence of the same source table?
April 13, 201510 yr Ah, here comes the challenge. Would I need to duplicate each line in the global for each table occurence of the same source table? Let me turn this question back to you: if I marked a record in the context of a specific occurrence of a table, is it supposed to be highlighted in all occurrences of the same base table?
Create an account or sign in to comment