Stumped again - Show 2 fields in lookup for Add Record
Archived from the Xataface Users forum.
jonbfl — Wed Sep 21, 2011 4:16 pm
Hi everyone
I have several many-to-many relationships in my application. I have them working as needed with Join Tables and relationships.ini files. Works just like I wanted The user can select one or more ‘codes’ from tables for things like HR_violation_code, HR_violation_mo and so forth to attach those attributes to a given victim. (that’s a very elegant mechanism)
- Code: Select all
[cases] __sql__ = "SELECT * FROM CasesVictims, cases WHERE cases.id_cases = CasesVictims.id_cases AND CasesVictims.id_victims = '$id_victims'" [hr_violation_mo] __sql__ = "SELECT * FROM VictimsHr_violation_mo, hr_violation_mo WHERE hr_violation_mo.idhr_violation_mo = VictimsHr_violation_mo.idhr_violation_mo AND VictimsHr_violation_mo.id_victims = '$id_victims' " [hr_violation_code] __sql__ = "SELECT * FROM VictimsHr_violation_code, hr_violation_code WHERE hr_violation_code.idhr_violation_code = VictimsHr_violation_code.idhr_violation_code AND VictimsHr_violation_code.id_victims = '$id_victims' "
Currently when you select one of the Tabs for a related record, and you use the ‘add existing record’ function, Xataface ‘apparently’ displays the value of the 1st non-id field/column (which is what I expected) it contains our ‘code value’ i.e. ‘mue002’ - what I would like to have happen is to also supply the ‘next column’ also - its a translated field with the ‘text description’ in each language. If I can only have one, then the text field is preferable. Is this a forms/templates issue? I have been wracking my brain all day.
Thanks for an amazing tool Steve.
shannah — Wed Sep 21, 2011 4:22 pm
I believe this dropdown shows the titleColumn() method of the target table’s delegate class.
jonbfl — Wed Sep 21, 2011 7:43 pm
Absolutely brilliant - worked first try!
Thanks very much, now I have a few things to experiment with there!
jonbfl — Wed Sep 21, 2011 8:05 pm
Well, with your good examples I got the two fields concatenated - seems to work as it should also
/me does the Snoopy Happy Dance -