Creating barcode id - uncheck box

I have this page where a user can check boxes to produce a value for a barcode. How can I handle when a box is unchecked remove that part from the barcode value.

On the barcode create an Expression Structure binding referencing each of the checkboxes and calculate the output.

Doesn't expression structure return an object? I have never used expression structure.

Im thinking whenever a check box is selected add the correct value to barcode value , and just have a master reset button which clears the barcode value, but that still would be weird if one was unchecked and nothing happened

Show examples of how the barcode string should be assembled with and without the various parts. And what the result should be if all checkboxes are off.

It will be assembled however the user wants. The order they selected them in concatenate the value to the barcode value. Say the user checks ProductID and SampleID - The ProductID param and SampleID param from view get concatenated to the barcode value. If nothing is checked the barcode value stays empty.

Yes it does and the individual elements can be read.

Expression
if({value}['chkProd'], {view.params.ProductID}, "")
+ "-" +
if({value}['chkSamp'], {view.params.SampleID}, "")
+ "-" +
if({value}['chkSub'], {view.params.SubSampleID}, "")

The expression will re-evaluate any time any of the structure bindings change. That's what you want and you have no tricky scripting to sort out.

Thanks Ill try it out