Records not posting within many-to-one relations

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

Postby confundido » Fri Jul 28, 2006 8:39 am

I have to say, so far I am very impressed with Dataface. WOW! So many good things come out of Canada. Of course, like a typical clueless American, I have no idea what they are... But I DO know they exist. ;) kudos to our northern neighbor!

Now I have a problem. I work in a public school int the Adult Basic Education department. I am setting up a relational database to manage student data for pit ESL program.

for example, I have a table that stores sites (It's a big school district with several adult schools), and I have a table that stores classes. There is a one to many relationship where the sites are the source table, and the classes are the destination table. (Of course a site has many classes, but classes don't meet at more than one site) When I try to add classes through the site table, I click the add record to program classes link
and get the fields I set up (except the keys which i hid):
class level: 2b
class section: 30
class term: fall
class term year: 2006
class room: 324

Then I hit save, and I get the same form:
class level: 2b
class section: 30
class term: fall
**class term year: 0000
class room: 324

Class term yyear reverts to the default value, and the record does not save. Insights?

Nathan
confundido
 
Posts: 8
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jul 28, 2006 8:51 am

Hi Nathan,

Thanks for the compliments on the framework. Hope we can get this problem solved. Can you post the relevant portions of your relationships.ini file so that I can take a look?

Best regards

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby confundido » Fri Jul 28, 2006 9:14 am

in /tables/prgm_site_locations/relationships.ini

[Site Classes]
prgm_classes.site_ID = "$site_ID"

---------------------------------

table info from phpMyAdmin

prgm_site_locations

Field Type Null Default
site_ID smallint(6) No
site_name varchar(50) No
site_addr varchar(100) No
site_city varchar(11) No Minneapolis
site_state char(2) No MN
site_zip varchar(10) No 554
site_pri_phone varchar(12) No


Indexes:
Keyname Type Cardinality Field
PRIMARY PRIMARY 2 site_ID
-----------------------------------

prgm_classes

Field Type Null Default
class_ID smallint(6) No
site_ID smallint(6) No 0
class_lvl char(3) No
class_sec char(2) No
class_term varchar(4) No
class_term_year year(4) No 0000
class_rm char(3) Yes NULL


Indexes:
Keyname Type Cardinality Field
PRIMARY PRIMARY 1 class_ID
confundido
 
Posts: 8
Joined: Wed Dec 31, 1969 5:00 pm

Postby Aoirthoir » Fri Jul 28, 2006 9:58 am

I was getting this same issue when I used the __sql__ = for my relationships. Since I had multiple levels I figured sql was the best way to go. Once I switched over to using straight dataface code though it worked all of the sudden. It had seemed to work before, but then I changed my linking fields to not null default = 0. So I thought that had something to do with it. When I set it back to allow null default null it still did not work. Anyhow finally I went to the dataface code as I said and it worked fine.
Aoirthoir
 
Posts: 420
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jul 28, 2006 10:15 am

Hi Nathan,

Thanks for pointing this out. It appears that Dataface doesn't like spaces in the names of relationships. If you change your relationships.ini file to:

[SiteClasses]
prgm_classes.site_ID = "$site_ID"
action:label = "Site Classes"

It will work (i tried it out) and should achieve the desired results. (sorry that action:label flag is as yet undocumented :) )

Best regards

Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Aoirthoir » Fri Jul 28, 2006 11:55 am

Ah I tried that Mr. Steve and it worked great. Another question then related to this, currently my relationship tabs appear in any order they want it seems. I at first thought it was based on the table layout in MySQL (thus alphabetical) but this is not the case. They are just in a random order. Also even with the label used, the tabs are always lowercase.

Holler
Aoirthoir
 
Posts: 420
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jul 28, 2006 1:02 pm

>my relationship tabs appear in any order they want it seems.
You can add action:order parameters as follows to your relationships:

[relationship1]
foo.bar='$barid'
action:order = 2

[relationship2]
foo2.bar='$bar2id'
action:order=1

In this case relationship 2 would be displayed before relationship 1.

As far as the tabs still being lower case, this is from a setting in the style sheet plone.css. That is the way it was in plone and I just didn't change it.. It is the text-transform property.
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jul 28, 2006 1:03 pm

damn smileys...

that is the action : order property (just leave out the spaces on either side of the ':')
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby Aoirthoir » Fri Jul 28, 2006 1:36 pm

Excellent that worked great. The tabs are now in the order that I wish. Also I did a search and replace on

text-transform: lowercase;

to

joeyfrantztext-transform: lowercase;

(that is how I replace code but know it was a change that I made) So now all my tabs are displayed as typed.

Thanks again bro!
Aoirthoir
 
Posts: 420
Joined: Wed Dec 31, 1969 5:00 pm

Postby confundido » Fri Jul 28, 2006 3:12 pm

You guys are the best! Thanks!
confundido
 
Posts: 8
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 6 guests

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