Page 1 of 1

Posted:
Thu Apr 12, 2007 6:38 am
by Scott
hi Steve,
it would be very useful to have a feature that allows us to have a picklist that can select multiple "id's" for insertion in a linktable.
for instance: when we have a product, category and productcategory table and we want to add (a lot of) existing products to a category, now we can only select one product in the "add existing related record" screen.
this is not so practicle when we have to add about 50 existing products or so.
i could not find how to do this "out of the box" in dataface.
is this kind of feature in the todo list of a future dataface (or is there an easy way to accomplish this already)?
Scott.

Posted:
Thu Apr 12, 2007 7:52 am
by shannah
Hi Scott,
This would be a good feature to have.Ê I have thought about possibly making an alternative "relationship" view for certain types of relationships, so that instead of showing a list of related records, it shows a checkbox group of all possible related records with the related ones checked.Ê I have not done this yet though.
In the coming version of dataface, however, I have implemented an "Update Set" form that allows you to apply bulk changes to multiple records at once.Ê This could be used to set the "category" field, say, of a whole group of records all at once.Ê However it won't help if it is a many-to-many relationship.
-Steve

Posted:
Thu Apr 12, 2007 9:02 am
by Scott
great! looking forward to mess with 0.7 (but no need to hurry, so much stuff to play around with in 0.6 already hehe)

Posted:
Sat Jul 05, 2008 6:31 am
by nathanmeyers
Hello Steve,
I'm a new user, developing an online db for a non-profit. Very impressive product - glad I found it. I'm using 1.0Beta3, and it's very close to meeting all my needs. The one thing I'm wishing for is exactly the topic of this post from last year: bulk addition of related records. Is this anywhere in the plans?

Posted:
Mon Jul 07, 2008 9:47 am
by shannah
Hi Nathan,
For simple relationships change it so that it just shows a group of checkboxes (one for each possible related record), from which you can check which records you want to have in the relationship.
You would do this by adding
- Code: Select all
action:delegate=related_records_checkboxes
to the relationship in the relationships.ini file.
An alternative way to manage related records is to use a transient field and a grid widget. Here is a snippet from the manual (under construction):
The grid widget is a special, compound widget that provides a spreadsheet-like input option for entering related records. This widget can only be used on transient fields\footnote{Transient fields defined in the fields.ini file but don't have a corresponding field in the database table. The are used to provide the user with input options that would not otherwise be available}, and it requires that the relationship directive be set to reference an valid relationship.
As an example, suppose we wanted to be able to edit the profile's Posts in a grid widget on the Profiles edit form. The Posts relationship is defined in the relationships.ini file. We would begin by adding the following to the Profiles fields.ini file:
\begin{verbatim}
[Posts]
transient=1
relationship=Posts
widget:type=grid
\end{verbatim}
This would cause a grid widget to show up on the Posts edit form. It allows the user to enter multiple posts at once. Let's look at these options a little closer:
\begin{enumerate}
\item \textbf{transient=1} - This indicates that this field does not have a corresponding column in the table, and we know that it doesn't. It let's Xataface know that this field definition is not a typo.
\item \textbf{relationship=Posts} - This indicates that this widget will be editing records from the Posts relationship.
\end{enumerate}
One thing to notice is that this grid contains all of the columns from the Posts table. This may be a bit of an annoyance, so it is possible to explicitly specify which fields should appear by way of the widget:columns directive. For example if we want the postTitle, and postContent fields to be included in the grid we would adjust our fields.ini definition as follows:
\begin{verbatim}
[Posts]
transient=1
relationship=Posts
widget:type=grid
widget:columns="postTitle,postContent"
\end{verbatim}
best regards
Steve

Posted:
Mon Jul 07, 2008 9:54 am
by nathanmeyers
Excellent! I'll give it a try - thanks!

Posted:
Mon Jul 07, 2008 4:50 pm
by nathanmeyers
OK, I've tried both approaches. I have two tables linked by a many-to-many relationship, and I need, in one of the tables, to select an entry and associate it with some subset of records in the other. The checkboxes support this much better than the grid widget.
That said - it almost works! I see checkboxes and they work as expected - creating or removing the join records appropriately. But the display of the checkboxes isn't what I'd hope. The format is basically:
[checkbox][X1] [checkbox][X1] [checkbox][X3]...
where X1, X2, and X3 are the contents of the first column (from the related table) after the ID - with no line breaks between these entries. I'd like to choose which columns to display, and have line breaks. I'm perusing the relationship checkbox code to see if I can figure it out... any guidance would be most welcome.

Posted:
Tue Oct 07, 2008 1:08 pm
by luuk
Hello,
I have exactly the same question as NathanMeyers :
Is it possible to align or to order the records of the related table so that it is easier to find and to "pick" them ?
Many thanks in advance !

Posted:
Fri Oct 17, 2008 7:48 am
by shannah
Not at this time. It won't be a difficult feature to add, but haven't had a chance to look at this yet.
Re: picklist funcionality for adding multiple records

Posted:
Wed Dec 22, 2010 1:41 am
by fantomasdm
Hi, It's possible to add <br>, for new line, after each checkbox??
I'm looking to file RelationshipCheckboxForm.php for change layout of checkbox, does is it correct?
Re: picklist funcionality for adding multiple records

Posted:
Wed Dec 22, 2010 3:10 am
by fantomasdm
Hi, for workaround I have add this code to actions\related_records_checkboxes.php
- Code: Select all
$out = str_replace("</label>","</label><br>",$out);
and I have a <br>....but I don't think is very good solution!