Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a macro that I use to define a "searchby" feature on my dashboard. This feature allows me to search by a list of values for every field.
The problem is that I am able to search by fields that have numeric values or non-numeric values, but unable to search by for fields that have alphanumeric values.
Below is the macro I use. Any suggestions about how to make it allow search by alphanumeric values?
Sub SetList
set doc = ActiveDocument
set sheet = doc.Sheets("Dashb1")
Dim list,A
list = doc.getVariable("vItemList").GetContent.String
A = Split(list,",")
dim counter,item2
counter=0
for Each item in A
item2 = LTrim(item)
A(counter) = RTrim(item2)
counter=counter+1
Next
set myFields = doc.fields("%SearchBy").GetSelectedValues
for i=0 to myFields.Count - 1
set f = doc.fields(myFields.Item(i).text) 'for example "Recruiter Name"
set fv = f.GetNoValues 'empty array
counter=0
for Each item in A
fv.Add
fv(counter).Text = item
if myFields.Item(i).text = "CC" _
or myFields.Item(i).text = "D" _
or myFields.Item(i).text = "LN" _
or myFields.Item(i).text = "MId" _
or myFields.Item(i).text = "MLN" _
then
'msgbox(item)
fv(counter).Number = item
fv(counter).IsNumeric = true
elseif myFields.Item(i).text = "CCId" _
then
fv(counter).Text = item
else
fv(counter).IsNumeric = false
end if
counter=counter+1
Next
f.SelectValues fv
Next
End Sub
This section in bold is what I am trying to get to work:
elseif myFields.Item(i).text = "CCId" _
then
fv(counter).Text = item
CCId has alphanumeric values. Setting isNumeric = False for this field allows me to search by values that are alphanumeric but it fails for those values that are completely numeric. The above code that does not set anything, does not work either. I was not able to find any isAlphaNumeric member that would allow me to do this.