Choice Control Save New Data only

  • 8 October 2015
  • 2 replies
  • 0 views

Badge +4

Good Morning,

I have choice control within my view that can allow the user to select from a drop down list of type in their own. I am trying to have the view save any of the new data typed into the choice control to be available again for later use. I have tried just using the execute smartobject method (save) but it will save what ever is in the drop down box as well.

 

The other rule I was trying to use was Execute a SmartObject method for items that have been changed but with the Smart object selected and Add or Changed Item state it does not appear to work.

 

Lots of posts in the recent days haha the more complicated bits are harder to work out :)

 

Thanks,
Martin


2 replies

Userlevel 5
Badge +16

Hi,

 

I'm using K2 BP 4.6.10 and I managed to get what you're trying to achieve successfully, I added the choice control on a view and enabled Allow Own Value property.

 

I have a button and a rule attached to it:

 

When button is clicked 

 

execute SmartObject method(select Create method then map the choice control in the input properties.

 

there is a problem(bug) is this control, if the user select a value from the drop down list (item is already saved) I can't prevent the rule from not saving an existed value.

 

UPDATE

 

I think you can apply the following workaround:

 

let's assume you have button to insert every new value,

 

When button is clicked

 

Execute List Method (here you pass the value of the choice control and add filter "where the value in the SQL table EQUALS the value of the choice control", return the value from the SQL table to a hidden datalable)

 

If advanced condition (here you check if the value of the choice control NOT EQUAL the value of the hidden datalable)

 

Execute Create Method (here you insert the value of the choice control)

 

 

let me know if you have any idea to discuss about, I didn't implement this workaround yet.

 

wish this helps.

Badge +4

Hello,

I attempted your workaround you have suggested and unfortunately my drop down box fails to populate with any data.

I'm thinking now that there isn't a current realistic approach to avoid saving duplicates.

 

I am current idea at this present moment maybe useful to any other people:

Have two seperate controls (Drop down list and text box). The list will pull the get list method from the dedicated smartobject and have the text box rules write to the smart object if there is any input (Nothing will write if nothing is inputted) this should avoid duplicates being generated from the text box selection.

 

I am going to involve validation rules to stop users from selecting both boxes which will cause issues when saving.

 

I'll update on how this works.

 

SOLVED:

Found a valid workaround. Create two controls as I stated above and an add button. User fills in text box clicks add and it will appear in the drop down list. This stops duplicates being saved when the drop down list is used. May be a nuisance and it doesnt stop the user just adding in loads of spelling mistakes etc but I know this works for now and it will just have to be maintained.

 

 

Thanks for the help though helps me brainstorm haha

Reply