xataface and many-many-relationships (errors with "sele

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

xataface and many-many-relationships (errors with "sele

Postby ppuschmann » Fri Feb 20, 2009 7:42 am

Hi,

I gave xataface a try today. It works like a charm. I only have two issues...

I want to create a internal product-database and separated some options to make the database-structure itself easier and, of course, to avoid redundancies.

My Table-Layout:

artikel_details (main-table):
- artikel_id (PK, INT)
- ... various other columns

fk_medium (values stored):
- medium_id (PK,INT)
- name (VARCHAR)

fk_signale (values stored):
- signale_id (PK, INT)

Here come the relationship-tables:

matrix_signal:
- artikel_id (PK together with signale_id)
- signale_id
- anzahl

matrix_medium:
- artikel_id (PK together with medium_id)
- medium_id

content of tables/artikel_details/relationship.ini:
Code: Select all
[matrix_signale_loop]
fk_signale.signale_id = matrix_signale.signale_id
matrix_signale.artikel_id = "$artikel_id"

[matrix_medium]
fk_medium.medium_id = matrix_medium.medium_id
matrix_medium.artikel_id = "$artikel_id"


When I create a new entry in my main-table (artikel_details), I also want to add different relations to "medium" and "signal" as well. Therefore I set up a "select-widget".

Here tables/matrix_medium/fields.ini
Code: Select all
[medium_id]
widget:type = select
vocabulary = mediumliste

where mediumliste is defined in tables/matrix_medium/valuelists.ini:
Code: Select all
[mediumliste]
__sql__ = "SELECT medium_id, name FROM fk_medium ORDER BY name;"



When I have the entry
Code: Select all
fk_medium.medium_id = matrix_medium.medium_id

in my relationship.ini everything will be fine, except my "select-widget".

When I remove this line of code, there will be a entry "Untitled matrix_medium Record" in my overview, but the "select-widget" will work.

Another special thing:
My table "matrix_signale" contains a column where additional data is to be stored: "anzahl". I think because of this there is always the "error" "Untitled matrix_medium Record". My "select-widget" is working fine.

Of course it would be very cool to the related values in the "detail-view" and to have working "dataset-overview (left-top-corner)".

What can we do? Xataface Version is from today, running on Debian Etch, MySQL. There are certain foreign key in the database to have the relationships also in the DB.

I just want (someone) to add a huge amount of data (by hand) and want to have it all clean and simple.

Best regards,

Paul
ppuschmann
 
Posts: 6
Joined: Fri Feb 20, 2009 7:15 am

Postby shannah » Fri Feb 20, 2009 9:58 am

When I have the entry
Code:
fk_medium.medium_id = matrix_medium.medium_id

in my relationship.ini everything will be fine, except my "select-widget".


When you are adding new related record you cannot edit any fields that are involved in the relationship. They are constrained to satisfy the relationship. It wouldn't make sense to allow this since if you put a value other than one that satisfies the relationship, then the record that you add would end up not being part of the relationship. For example if you change the value of the medium_id field when adding a record to the relationship, then the value you set in the medium_id may not match fk_medium.medium_id and thus the record wouldn't be part of the relationship.

If you add a new matrix_medium record via that new record form (not the new related record form) you'll see the select list fine. Also if you go to edit a matrix_medium record that you have already added, the select list will show up fine.

This is a feature not a bug.

because of this there is always the "error" "Untitled matrix_medium Record"


This is not an error. Xataface tries to guess an appropriate title for your record - usually by showing the value of the first varchar field in the record. If there are no varchar fields in the record then it will just say "Untitled ... record". You can explicitly define a title for your records via the getTitle() method in the delegate class.

Of course it would be very cool to the related values in the "detail-view" and to have working "dataset-overview (left-top-corner)".

Can you elaborate? I'm not sure I fully understand what you are looking for here.

I just want (someone) to add a huge amount of data (by hand) and want to have it all clean and simple.


For optimized date entry you may want to look into:
1. The DataGrid module
2. Writing a custom import filter to allow the user to import many records at a time in a format of your choosing.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ppuschmann » Mon Feb 23, 2009 12:38 am

shannah wrote:
When I have the entry
Code:
fk_medium.medium_id = matrix_medium.medium_id

in my relationship.ini everything will be fine, except my "select-widget".


When you are adding new related record you cannot edit any fields that are involved in the relationship. They are constrained to satisfy the relationship. It wouldn't make sense to allow this since if you put a value other than one that satisfies the relationship, then the record that you add would end up not being part of the relationship. For example if you change the value of the medium_id field when adding a record to the relationship, then the value you set in the medium_id may not match fk_medium.medium_id and thus the record wouldn't be part of the relationship.

If you add a new matrix_medium record via that new record form (not the new related record form) you'll see the select list fine. Also if you go to edit a matrix_medium record that you have already added, the select list will show up fine.

This is a feature not a bug.


Hm, I hope there is a slight case of missunderstanding here...

I want to enter a dataset in my main-table "artikel_details.
I enter my new record and then klick on a tab of my related records/tables like matrix_medium. Here I want to create (in this instant moment) a new entry (a new relationship) in the table matrix_medium. The Value of artikel_id is okay, but I only want to select the value of Medium_id (the PK of fk_medium).

Perhaps this is the limitation of a ready-to-use framework. It (of course) cannot guess what weird database scheme I have.

I hope there might be a solution.
Of course it would be very cool to the related values in the "detail-view" and to have working "dataset-overview (left-top-corner)".

Can you elaborate? I'm not sure I fully understand what you are looking for here.

This is just an issues related to the "Untitled Record"-error/issue. --> Solved.

I just want (someone) to add a huge amount of data (by hand) and want to have it all clean and simple.

For optimized date entry you may want to look into:
1. The DataGrid module
2. Writing a custom import filter to allow the user to import many records at a time in a format of your choosing.

I will take a look.
ppuschmann
 
Posts: 6
Joined: Fri Feb 20, 2009 7:15 am

Postby shannah » Mon Feb 23, 2009 7:25 pm

Hm, I hope there is a slight case of missunderstanding here...

I want to enter a dataset in my main-table "artikel_details.
I enter my new record and then klick on a tab of my related records/tables like matrix_medium. Here I want to create (in this instant moment) a new entry (a new relationship) in the table matrix_medium. The Value of artikel_id is okay, but I only want to select the value of Medium_id (the PK of fk_medium).


Could be a misunderstanding ... Here is the way Xataface works:
On the new *related record* form you cannot edit any foreign key fields. This is because Xataface already knows what those fields need to be to make the record part of the relationship. If you want to be able to edit a foreign key field, you should use the *new record* form instead as it has no such aspirations of making the record part of any particular relationship.

If you need to you can add a link to your interface to make it easier to perform frequent actions.

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby ppuschmann » Thu Feb 26, 2009 1:07 am

Dear Steve,

I'll look through my relationships.
Status quo is that all relationship-tables (beginning with matrix_) are empty, so I've to use the "new record".

How can I create a link to my interface?
ppuschmann
 
Posts: 6
Joined: Fri Feb 20, 2009 7:15 am

Postby shannah » Thu Feb 26, 2009 8:41 am

How can I create a link to my interface?


You can link to any part of your application using Xataface URL conventions:
http://xataface.com/wiki/URL_Conventions

To add your custom content (e.g. links) to various places in the UI see:
http://xataface.com/documentation/tutor ... ustomizing

Specifically the section on blocks.

-Steve
shannah
 
Posts: 4457
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