Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
veldetta
Contributor III
Contributor III

vba search and table creation

Hi!

I have a data model loaded which consists of individuals and their attributes - first name, last name, company, dob,  individual ID, etc....

I'm attempting to make a search-like function using macros where a user inputs a a variable into an input box and clicks a button.  

This button will search for that variable in the data set and will return a match.  For example, if the user inputs 'Robert' as the search variable, the vba/macro search the data model and return the search results (searching each field):

- fName lName
- James Roberts 
- Robert Williams

Is this possible to do with Qlikview / VBA?

 

6 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Can you use the built in Search Object instead of a macro for this?

-Rob

veldetta
Contributor III
Contributor III
Author

The end users would like an input box with a button... which in turn will produce the search results.

 

So far, I have this code but it currently only searches 1 field:

 

Sub SelectVar
	ActiveDocument.Fields("Field").Clear
	set vSel = ActiveDocument.Variables("vSearchName")
	ActiveDocument.Fields("Field").Select vSel.GetContent.String


End sub

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

"The end users would like an input box with a button"

Isn't that what a search object is? (minus the button)

veldetta
Contributor III
Contributor III
Author

I understand what your suggestion is... the search box.  What I'm saying is I'm looking for another alternative other than the search box which is an input box, a button with VBA code in the background. 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Got it.  What you can do with the macro code is loop through a list of fields and use the Field.SearchFor method to search each field in turn and then consolidate the results. 

-Rob

veldetta
Contributor III
Contributor III
Author

Thanks! I used your recommendation.