Skip to main content

when I select snijden and zetten in checkbox

In workchain_id both should be add with slash in between them

example like: snijden / zetten 

You can only select 1 value in a lookup. I think the easiest way to achieve this would be to create a view with all possible combinations: 

Snijden
Snijden / Zetten
Zetten 
etc. 

and in the default set the workchain_id based on the selected tickboxes. 


Hello naveen,

If the number of actions remains static (i.e. no new actions will be added to the current 6), then I would recommend using an expression combined with a domain with elements instead of a view. This allows you to have the translations for these elements inside of your application model.

If you expect to add many more actions or if you have no interest in ever translating your application to another language, then the simplest solution is an expression that concatenates static translations.

Solution with hardcoded translations

For the hardcoded translations solution, simply make workchain_id an expression column and give it an expression like this:

select string_agg(t2.work, ' / ')
from
(
select 'Kantenbreken' as work
where t1.kantenbreken = 1

union

select 'Lassen' as work
where t1.lassen = 1

union

select 'Snijden' as work
where t1.snijden = 1

union

select 'Vormen' as work
where t1.vormen = 1

union

select 'Zetten' as work
where t1.zetten = 1

union

select 'Laskanten' as work
where t1.laskanten = 1
) t2

Solution with translations in application model

If you use a bitwise progression of values for each of the checkboxes (i.e. 1, 2, 4, 8, 16, etc.) then each combination of actions forms a unique value representing that combination.

The workchain_id parameter (and columns in other locations) can then be a very simple expression column that looks something like this:

select sum(iif(t1.kantenbreken = 1, 1, 0) +
iif(t1.lassen = 1, 2, 0) +
iif(t1.snijden = 1, 4, 0) +
iif(t1.vormen = 1, 8, 0) +
iif(t1.zetten = 1, 16, 0) +
iif(t1.laskanten = 1, 32, 0))

This expression produces the value that represents the unique combination of checked actions.

The expression column should then have 63 elements defined on its domain like this:

1 Kantenbreken
2 Lassen
3 Kantenbreken / Lassen
4 Snijden
5 Kantenbreken / Snijden
6 Lassen / Snijden
7 Kantenbreken / Lassen / Snijden
8 Vormen
9 Kantenbreken / Vormen
10 Lassen / Vormen
11 Kantenbreken / Lassen / Vormen
12 Snijden / Vormen
13 Kantenbreken / Snijden / Vormen
14 Lassen / Snijden / Vormen
15 Kantenbreken / Lassen / Snijden / Vormen
16 Zetten
17 Kantenbreken / Zetten
18 Lassen / Zetten
19 Kantenbreken / Lassen / Zetten
20 Snijden / Zetten
21 Kantenbreken / Snijden / Zetten
22 Lassen / Snijden / Zetten
23 Kantenbreken / Lassen / Snijden / Zetten
24 Vormen / Zetten
25 Kantenbreken / Vormen / Zetten
26 Lassen / Vormen / Zetten
27 Kantenbreken / Lassen / Vormen / Zetten
28 Snijden / Vormen / Zetten
29 Kantenbreken / Snijden / Vormen / Zetten
30 Lassen / Snijden / Vormen / Zetten
31 Kantenbreken / Lassen / Snijden / Vormen / Zetten
32 Laskanten
33 Kantenbreken / Laskanten
34 Laskanten / Lassen
35 Kantenbreken / Laskanten / Lassen
36 Laskanten / Snijden
37 Kantenbreken / Laskanten / Snijden
38 Laskanten / Lassen / Snijden
39 Kantenbreken / Laskanten / Lassen / Snijden
40 Laskanten / Vormen
41 Kantenbreken / Laskanten / Vormen
42 Laskanten / Lassen / Vormen
43 Kantenbreken / Laskanten / Lassen / Vormen
44 Laskanten / Snijden / Vormen
45 Kantenbreken / Laskanten / Snijden / Vormen
46 Laskanten / Lassen / Snijden / Vormen
47 Kantenbreken / Laskanten / Lassen / Snijden / Vormen
48 Laskanten / Zetten
49 Kantenbreken / Laskanten / Zetten
50 Laskanten / Lassen / Zetten
51 Kantenbreken / Laskanten / Lassen / Zetten
52 Laskanten / Snijden / Zetten
53 Kantenbreken / Laskanten / Snijden / Zetten
54 Laskanten / Lassen / Snijden / Zetten
55 Kantenbreken / Laskanten / Lassen / Snijden / Zetten
56 Laskanten / Vormen / Zetten
57 Kantenbreken / Laskanten / Vormen / Zetten
58 Laskanten / Lassen / Vormen / Zetten
59 Kantenbreken / Laskanten / Lassen / Vormen / Zetten
60 Laskanten / Snijden / Vormen / Zetten
61 Kantenbreken / Laskanten / Snijden / Vormen / Zetten
62 Laskanten / Lassen / Snijden / Vormen / Zetten
63 Kantenbreken / Laskanten / Lassen / Snijden / Vormen / Zetten

As you can see, this does get out of hand very quickly. This is why I would say that 6 actions is just about the limit for a solution like this. With 7 actions you would need 127 elements, then 255, 511, and so on.

I wrote a little SQL script that produced the list above for me:

declare @kantenbreken int = 1;
declare @lassen int = 2;
declare @snijden int = 4;
declare @vormen int = 8;
declare @zetten int = 16;
declare @laskanten int = 32;

declare @kantenbrekenTransl varchar(100) = 'Kantenbreken';
declare @lassenTransl varchar(100) = 'Lassen';
declare @snijdenTransl varchar(100) = 'Snijden';
declare @vormenTransl varchar(100) = 'Vormen';
declare @zettenTransl varchar(100) = 'Zetten';
declare @laskantenTransl varchar(100) = 'Laskanten';
declare @separator varchar(10) = ' / ';

declare @i int = 1;
declare @max int = @kantenbreken + @lassen + @snijden + @vormen + @zetten + @laskanten;

while @i <= @max
begin
declare @concatenatedString varchar(1000) = (
select string_agg(work, @separator)
from
(
select @kantenbrekenTransl as work
where (@i & @kantenbreken) = @kantenbreken
union
select @lassenTransl as work
where (@i & @lassen) = @lassen
union
select @snijdenTransl as work
where (@i & @snijden) = @snijden
union
select @vormenTransl as work
where (@i & @vormen) = @vormen
union
select @zettenTransl as work
where (@i & @zetten) = @zetten
union
select @laskantenTransl as work
where (@i & @laskanten) = @laskanten
) t
);

print convert(varchar(10), @i) + ' ' + @concatenatedString;
set @i += 1;
end

I hope this helps.


Hopefully Vincent helped you out with his extensive example. If there are anymore questions, please continue in your first topic. I'll close this topic for now. 

About checkbox | Thinkwise Community (thinkwisesoftware.com)