# New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Save the Date: QlikWorld Online, June 24-25, 2020. Free global virtual event for data integration and data analytic gurus. Register Today
Highlighted
Not applicable

## Compare two bookmarks

Hi,

is it possible to compare one field with itself based on two different states of selections. I have one bookmark that gives me the part list: A,B,C,D,E,F. Second bookmark gives me: B,C,D,G. Can I compare somehow theese two bookmarks to get final list: A,E,F (only values that are in bookmark one but not in bookmark two)? I need only list from this field.

I feel that macro can solve this problem but I do not have that much knowledge. I appreciate any help.

1 Solution

Accepted Solutions
Highlighted
Not applicable

## Re: Compare two bookmarks

Hi again,

yes it is possible. It took me some time to fix all variables and with help topics I was able to make this code. Thats why I want to share it. I do not know if it is optimal solution, but it works and it is fast enough.

 sub ExtractParts'Field to filterset araj=ActiveDocument.Fields("G_VCC")'Activate first bookmarkActiveDocument.RecallDocBookmark "Set1"'Take possible values from field G_VCC into arraySET PrvaLista = araj.GetPossibleValues 'Activate second bookmarkActiveDocument.RecallDocBookmark "Set2"'ake possible values from field G_VCC into arraySET DrugaLista = araj.GetPossibleValues'Count length of both arraysbrojac1 = PrvaLista.Countbrojac2 = DrugaLista.Count'loop throught both arrays. Goal is to check every line from first array with every line from second and to extract those that are same.for i=0 to brojac1 - 1     'Set variable with "i" line from array1    set VCC1 = PrvaLista(i)          'Loop through second array        for j = 0 to brojac2-1             'Set variable with "j" line from array2            set VCC2 = DrugaLista(j)                 'If value from first array is equal to value from second array                if VCC1.Text = VCC2.Text then                     'Then result is previous result;NewVariable                    Rezultat = Rezultat & PrvaLista(i).text & "; "                end if        nextnext 'At the end, result variable "Rezultat" is placed in previously created variable "Probna" in front end. There is textbox on frontend that takes variable "Probna"ActiveDocument.Variables("Probna").SetContent Rezultat, trueend sub

Question 2: How to format data in textbox. Right now I get a list with Part;Part;Part... Is it possible to get:

Part;

Part;

Part;

.

.

.

But this issue is solved Thank you all, because I used other  questions and answers to get this done.

Highlighted
Not applicable

## Re: Compare two bookmarks

Hi again,

yes it is possible. It took me some time to fix all variables and with help topics I was able to make this code. Thats why I want to share it. I do not know if it is optimal solution, but it works and it is fast enough.

 sub ExtractParts'Field to filterset araj=ActiveDocument.Fields("G_VCC")'Activate first bookmarkActiveDocument.RecallDocBookmark "Set1"'Take possible values from field G_VCC into arraySET PrvaLista = araj.GetPossibleValues 'Activate second bookmarkActiveDocument.RecallDocBookmark "Set2"'ake possible values from field G_VCC into arraySET DrugaLista = araj.GetPossibleValues'Count length of both arraysbrojac1 = PrvaLista.Countbrojac2 = DrugaLista.Count'loop throught both arrays. Goal is to check every line from first array with every line from second and to extract those that are same.for i=0 to brojac1 - 1     'Set variable with "i" line from array1    set VCC1 = PrvaLista(i)          'Loop through second array        for j = 0 to brojac2-1             'Set variable with "j" line from array2            set VCC2 = DrugaLista(j)                 'If value from first array is equal to value from second array                if VCC1.Text = VCC2.Text then                     'Then result is previous result;NewVariable                    Rezultat = Rezultat & PrvaLista(i).text & "; "                end if        nextnext 'At the end, result variable "Rezultat" is placed in previously created variable "Probna" in front end. There is textbox on frontend that takes variable "Probna"ActiveDocument.Variables("Probna").SetContent Rezultat, trueend sub

Question 2: How to format data in textbox. Right now I get a list with Part;Part;Part... Is it possible to get:

Part;

Part;

Part;

.

.

.

But this issue is solved Thank you all, because I used other  questions and answers to get this done.