Skip to main content

Hey K2 community, this is my first time trying to build an editable list view and I'm having an issue.  My main DB table has two columns which are foreign key IDs to other tables.

 

These tables have an ID and a description.  Their purpose is just to serve as a drop-down.

 

On my list view I want to show the descriptions, but on the Add/Edit Item line I want to show drop-downs.

 

I made a composite SmartObject of all the tables so that I could show the description in the list view. But I can't figure out how to get the drop-down to work.  If I change the control field from Description to ID on the Add/Edit Item line, then it changes it on the list view.

 

Any help would be appreciated. It's a silly thing to be stumped on but alas, I am.

Victoria,

You might have to manually do a Data Transfer of the value to the Drop Down (rather than setting the field as a property of the Drop Down) when you start "editing" a row.  Since there is only one instance of the Drop Down this should bypass the built in magic that is currently uses.

 

You might also, however, have a problem on your editing if your table only has two columns.  Lets say you have records:

ID,  RelatedId

1  ,   1

1  ,   2

1  ,   3

 

If I want to change 1, 2 to 1, 4 then I have to know that it WAS 1 , 2 to perform the update.  That might not be a problem here, but if this is your table, then it might make life easier to have an autogenerated (Identity or guid) as the immutable primary key then you can build unique indexes on the two fields to maintain good relations.  That is not part of your question, but I had a collegue that got really confused by this and add the key field both made the SF simple to read, but also made it easier to them to maintane.

 

Nathan


Sorry Nathan, either your response is one step ahead of me or I'm just misunderstanding. Allow me to elaborate my scenario... Let's say I have two database tables...

 

First table: Form_Data.

Columns: ID, Category_ID, Details.

 

Second table: Category_DropDown

Columns: Category_ID, Category_Description

 

I wish to make a SmartForms editable list view of categories and details.  From the user's prespective, category should be a drop down (of categories) and details is just open text for them to enter.  So I create a list view of Form_Data.Category_ID & Form_Data.Details. But Form_Data.Category_ID is a foreign key to Category_DropDown.Category_ID and isn't very helpful for the user, so I create a composite SmartObject to join these two tables so I can instead show Category_DropDown.Category_Description.

 

 

Now let's say I want to add a new row.  The Add/Edit Item row will show an open text field for Category_DropDown.Category_Description.  I wish to make this a drop down, using Category_DropDown as the data source.  If I change the control to a drop-down and set the field to Category_DropDown.Category_ID, then it changes that column in the list view back to ID.

 


First, sorry for projecting my problems onto you 😉.

 

Ok, I can duplicate the behavior, I have a form that does this, sorry I'm having trouble finding it at the moment.  I'll keep looking and post when I find it.


Much appreciated!  I hope you have better luck than I am having.


Just of out curiosity, why can't I add more than 1 row? I click "Add New Row", populate the fields, then when I click "Add New Row" again nothing happens.


Thanks for your response Audrey! Sounds like it might be because we are using stored procedures then.  I'll try using the direct tables and see if that works, but if it does then I'm not sure how we can get the stored procedures to work.  I was also thinking it could be because I don't want to save to the database until the form is actually submitted.  Like I said, it's my first time using an editable table so I'm not sure what is required to make it work and I'm not finding the documentation super helpful.


Has anybody figured this out yet by any chance?  My original issue with not being able to use drop downs, that is.


Anybody?


One easy way would be to display the description and actually save the value, so when the dropdown list is changed (description) transfer the value to the next column. 

 

The value column could easily be hidden by unchecking Visible control in it's column properties. 


Reply