Relationship between an event table and its topics

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

Relationship between an event table and its topics

Postby thelastcrisis » Fri May 14, 2010 10:42 am

I am trying to link a single event with multiple topics that can fluctuate depending on the event. In other words, one event might have three topics but another event might have 15 topics. I would really prefer not to code in the topics data into the events database because first of all it hard codes the number of topics into the event and it would make it hard for users to understand and add topics. I want my backend users to be able to click on the events tab, click on new record, and see the fields for the event and the topics data repeated something like 5 times or more.

Ideally, I would like a data entry person to see up to five empty topic fields to fill out and to be able to click a button to add more topics to the event if they need more than five. It doesn't have to work this way but that would be ideal.

My table structure is as follows:

[events]
event_id
event_name
event_location
event_date
start_date_promo
end_date_promo
promo_graphic_s3_bucket
promo_graphic_s3_filename
video_s3_bucket
video_s3_filename

[topics]
topic_id
event_id
topic_order
topic_title
topic_description


Is there a solution to this within Xataface?

Thanks,

Joe
thelastcrisis
 
Posts: 3
Joined: Fri May 14, 2010 9:29 am

Re: Relationship between an event table and its topics

Postby shannah » Fri May 14, 2010 10:49 am

Sounds like you want to have a relationship between the event table and the topics table. For data entry, you could use the grid widget to allow users to add/remove/edit topics on the edit form of the events table.

e.g.

in the events relationships.ini file:
Code: Select all
[topics]
    topics.event_id="$event_id"
    metafields:order=topic_order


In the events fields.ini file
Code: Select all
[topics]
    transient=1
    widget:type=grid
    relationship=topics
    widget:columns="topic_title,topic_description"
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Relationship between an event table and its topics

Postby thelastcrisis » Fri May 14, 2010 1:47 pm

Thank you for your reply. Yes, this is part of the way there... Is it possible for me though to allow for multiple entries of topics into the topics table referencing the same event_id? In other words, the ability to enter in multiple topics while entering in only the one event?

The code you gave me above allows for only one topic to be entered.
thelastcrisis
 
Posts: 3
Joined: Fri May 14, 2010 9:29 am

Re: Relationship between an event table and its topics

Postby shannah » Fri May 14, 2010 1:54 pm

This should allow multiple topics per event.
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Relationship between an event table and its topics

Postby thelastcrisis » Sat May 15, 2010 5:54 am

Thank you so much! It does exactly what I what.
thelastcrisis
 
Posts: 3
Joined: Fri May 14, 2010 9:29 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 27 guests

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