0

I'm trying to write a vbscript iif statement for visual studio which reads the value of a parameter and hides a column based on that parameter. The issue I am having is the parameter allows multi values so not sure how to word the iif statement.

I have a lookup called lookup.include which does this :

SELECT 'All' AS [TEXT] , '1,2,3,4' AS [VALUE]
UNION 
SELECT 'Welcome_Call' AS [TEXT], '1' AS [VALUE]
UNION
SELECT 'Month_One_Call'  AS [TEXT], '2' AS [VALUE]
UNION
SELECT 'Month_two_Call'   AS [TEXT], '3' AS [VALUE]
UNION
SELECT 'Month_six_Call'    AS [TEXT], '4' AS [VALUE]

This is a multi value parameter and allows the user to chose more than one value.

So I have a drop down list with the options below (ignore names)

So in my look up This is assigned a number value.

enter image description here

I have tried to do an vbscript if statement which says

iif (paramter.value <>  1   ,false,true)

which works if only Welcome call is selected , but wont if more than one option is selected.

What I need is basically to write an iif statement to test if the value I want is present in the options chosen.

E.g, if user selects Values 1,2,3 the if statement picks up that one is present.

Like the IN function in SQL , just the vb script equivalent

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
farrea
  • 43
  • 1
  • 10

1 Answers1

0

From your statement:

This is a multi value parameter and allows the user to chose more than one value.

It looks like you have a control like ListBox or CheckedListBox that display all the above UNION values in it. For such case you can get selected values from control itself OR you can maintain the selection in a string array. Later on you can use Array.IndexOf(stringArray, value) to see if your desired value exists in the collection stringArray of selected items.

NeverHopeless
  • 11,077
  • 4
  • 35
  • 56