This is actually a program in LabVIEW
but I can write C
scripts in labview and /or simulate the same logic
in LabVIEW
as in C
. also to attract more answers. So I just need the algorithm mainly. Please read the entire question.
In my application I have 5 variables say:
var1 -> type string,
var2 -> type string,
var3 -> type array of strings,
var4 -> type array of strings,
var5 -> type boolean
Now these 5 variables control how I should filter the data I read from a file.
So for this I have a switch case which will do the actions based on these inputs.
To control the switch I do this:
- if var1 is empty then
false
. - if var2 is empty then false.
- if var3 is an empty array then
false
. - if var4 is an empty array then
false
. - if var5
false
oftrue
.
So I get a 5 bit combination so I can have 32 values, hence 32 types of filters i.e 32 cases!.
For e.g if var1
is empty, var2
is not empty, var3
is not empty, var4
is empty, var5
is true then I have 01101 (13 in dec). So I choose the 13th filter.
Coding this is really hectic so I want to collapse the number of cases. How to do it?
What i'm looking for is an algorithm.
here is the labview code
var1 -> operator name, var2->supervisor name, var3->JobID, var4-> Multiple batch select, var5->invalid date.
EDIT. ;
an e.g
if var1 and var3 are not null then i have to read the data from file such that it contains var1 and var2 data.
e.g 2
now if var1, var3, var5 are not null then i need to select data such that it will have data common to var1 and var3 and var5.
e.g 3
if i have var1,var3,var4,var5 i need to fetch data that containds data which is common to var1 var3 var4 var5.
e.g4
if i have just var3 i need to fetch only data related to var3.