Hello All,
I would like to display charts based on some conditions being fulfilled.
I have pseudocoded the information. If the use of pseudocode is not acceptable please inform me and I will code it in vb.
Essentially I need to display inofrmation about Multidisciplinary Teams in a number of Datagrids. However I only wish to display that information where the Team exists for the relevant ward.
As can be seen below the code is not terribly maintainable.
'Use these flags to determine if the Team has been displayed
Team 1 displayed flag =0
Team 2 displayed flag =0
Team 3 displayed flag = 0
Team 4 displayed flag=0
'This contains the logic basically if statements
DatagridView 1
IF
Exists Team 1
THEN display Team 1
Now set Team 1 displayed flag = 1
ELSE
IF
Does not exist Team 1 AND exists Team 2
THEN display Team 2
Now set Team 2 displayed flag = 1
ELSE
IF
Does not exist Team 1 AND does not exist Team 2 AND exists Team 3
THEN display Team 3
Now set Team 3 displayed flag =1
ELSE
IF
Does not exist Team 1 AND does not exist Team 2 AND does not exist Team 3 AND exists Team 4
THEN display Team 4
'The same as above except we don't care about Team 1 and we have to check to make sure that Team 2 hasn't been displayed
DatagridView 2
IF exists Team 2 AND Team 2 displayed flag =0
THEN display Team 2
Now set Team 2 displayed flag =1
ELSE
'Here we have to check for no Team 2 and no displayed Team 3
IF
Does not exist Team 2 AND exists Team 3 AND Team 3 displayed flag =0
THEN display Team 3
Now set Team 3 displayed flag =1
ELSE
IF
Does not exist Team 2AND does not exist Team 3 AND exists Team 4 AND Team 4 displayed flag =0
THEN display Team 4
Now set Team 4 displayed flag =1
'As above
DatagridView 3
IF exists Team 3 AND Team 3 displayed flag =0
THEN display Team 3
Now set Team 3 displayed flag =1
ELSE
IF
Does not exist Team 3 AND exists Team 4 AND Team 4 displayed flag =0
THEN display Team 4
Now set Team 4 displayed flag =1
'as Above
DatagridView 4
IF exists Team 4 AND Team 4 displayed flag =0
THEN display Team 4
Now set Team 4 displayed flag =1
I hope this isn't too cheeky but is there a better as in much better way to do this allowing for maintainablilty, the addition of teams and so on.
warm regards
SpinSean