Stumped again - Show 2 fields in lookup for Add Record

A place for users and developers of the Xataface to discuss and receive support.

Stumped again - Show 2 fields in lookup for Add Record

Postby 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.

8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Stumped again - Show 2 fields in lookup for Add Record

Postby shannah » Wed Sep 21, 2011 4:22 pm

I believe this dropdown shows the titleColumn() method of the target table's delegate class.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Stumped again - Show 2 fields in lookup for Add Record

Postby 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!

8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm

Re: Stumped again - Show 2 fields in lookup for Add Record

Postby 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 -

8)
jonbfl
 
Posts: 66
Joined: Thu Jul 28, 2011 8:20 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 20 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved