Hi,
How to show a checkbox like below
Thanks a lots
Discussion posts and replies are publicly visible
Using a checkbox field! If you want to make it in two-column, then you can add two checkbox fields and split the values to have the first half in the first one and the second half in the second one.
if I use two checkbox, how to save values into database?
You can save the checkboxes field value to separate local variables and use the joinarray function to save the data into DB.
a!localVariables( local!value1, local!value2, /*to save DB*/ local!value, { a!columnsLayout( columns: { a!columnLayout( contents: { a!checkboxField( label: "Checkboxes", labelPosition: "COLLAPSED", choiceLabels: {"Option 1", "Option 2"}, choiceValues: {1, 2}, value: local!value1, saveInto: {local!value1, if(a!isNotNullOrEmpty(local!value2) ,a!save(local!value, joinarray(local!value1,local!value2)), a!save(local!value,local!value1))}, validations: {} ) } ), a!columnLayout( contents: { a!checkboxField( label: "", labelPosition: "COLLAPSED", choiceLabels: {"Option 3", "Option 4"}, choiceValues: {3, 4}, value: local!value2, saveInto: {local!value2, if( a!isNotNullOrEmpty(local!value1) ,a!save(local!value, joinarray(local!value1,local!value2)), local!value2)}, validations: {} ) } ), a!columnLayout( contents: {} ) } ) } )
I also think that, but when dose it save value into DB after chose checkbox field?
Appian does not store any data to your database automatically. I recommend to check the Appian Academy and Tutorials to understand how Appian works.
Something like the below:
a!localVariables( local!value1, local!value2, { a!columnsLayout( columns: { a!columnLayout( contents: { a!checkboxField( label: "Checkboxes", labelPosition: "COLLAPSED", choiceLabels: {"Option 1", "Option 2"}, choiceValues: {1, 2}, value: local!value1, saveInto: local!value1, validations: {} ) } ), a!columnLayout( contents: { a!checkboxField( label: "", labelPosition: "COLLAPSED", choiceLabels: {"Option 3", "Option 4"}, choiceValues: {3, 4}, value: local!value2, saveInto:local!value2, validations: {} ) } ), a!columnLayout( contents: { a!buttonLayout( a!buttonWidget( label:"Submit", saveInto: { a!writeToDataStoreEntity( dataStoreEntity: {your_entity_constant}, valueToStore: updatedictionary( your_local_varible_which_you_have_to_Insert, { fieldName_in_Which_you_want_to_store:joinarray({local!value1,local!value2},";") } ) ) } ) ) } ) } ) } )
Now you can replace updatedictionary() with a!update()