AaronF
Posts: 8
Joined: Fri Sep 13, 2013 6:40 pm

Comparing Values

Is there anyway to compare a value that is read from the registry against a list of valid values? I want to only display the agency select dialog box if the value read from the registy does not match one from the listbox. i.e. Users should only be prompted to select an agency if the agency identifier in the registry isn't a valid one. I know I could make a long condition such as A <> "1" and A <> "2" and A <> "3" etc...but that would be a very long condition and too long to even fit in the condition field. Is there anyway to compare A against a list of values? The values are already conditions in a list box.
Bogdan
Posts: 2791
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Comparing Values

Hi Aaron and welcome to our forums,

I'm afraid what you want is not supported by Windows Installer, but you have a simple workaround.
Just go to Install Parameters page and define a new property, then set its value to the entire list of possible values.
Then you can compare this new property with the registry search like this:

Code: Select all

MY_LIST_PROP >< REGISTRY_SEARCH
Best regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
AaronF
Posts: 8
Joined: Fri Sep 13, 2013 6:40 pm

Re: Comparing Values

Ok, I see how that would work. I wasn't familiar with the >< operator. I'm used to <> instead where both values must be identical. I think this will work. Thank you very much.
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Comparing Values

Hi,
I want to do something similar. I want to set a value for PROP1 depending on the value of PROP2 (that is introduced by the user). If PROP2 matches any of the values in my list "MY_LIST_PROP", then PROP1 will have the value "1"; if the value of PROP2 doesn't match any of the values in the list, then PROP1 will have the value "2".

The condition PROP2 << MY_LIST_PROP will work for me?

Thanks in advance,
Arnau.
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Comparing Values

And, can this list be populated from an XML file (or txt, or any other format)?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Comparing Values

Hello,

You can try to perform an XML Search. That search will be executed after the user presses the "Install" button on the "VerifyReadyDlg".

You'll also have to declare PROP1 with the value 2 in Install Parameters page. In the end just schedule a Set installer property custom action after Install Execution Stage - Searches action group that sets PROP1 to 1 if the search is successful.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Comparing Values

Hi,

I need to compare the user entry with my list before it is installed, because the result is used to change another xml of the application installed.

So, how can I put the values of a list in a single property?

Thanks in advance,
Arnau.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Comparing Values

Hello Arnau,

I understand, if you schedule the PROP1 "Set installer property" custom action right after Searches action you can reference PROP1 public property in any XML update set from the Files and Folders page.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Comparing Values

Hello,

I don't know if I explained myself as good as I want. :(
The XML to read will be installed as part of the application (and it's a pretty new application, so it will be first installation for every customer). Can the search operation search before the file is copied in the local disk?

I'll put the list in a single property in the "Install Parameters", but I don't know how to do that.

Thanks in advance,
Arnau.
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Comparing Values

Please,

Can someone explain me how to put a list of values in a single property?

Thanks,
Arnau.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Comparing Values

Hi Arnau,

If the XML file is part of the installation then the search cannot help you. The XML search is intended for files already present on the target machine.

There are no property types (like arrays) in Windows Installer so you can just add the list items to the property value with any separator you like. For example:

Code: Select all

Value1 | Value 2 | Value 3 
or

Code: Select all

Value1 ; Value 2 ; Value 3 
All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Comparing Values

Hi,

I'm sending you the AIP file because it is not working.

Thanks in advance,
Arnau.
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Comparing Values

My bad. I was setting the condition wrong. Left-right problems (facepalm).


Thanks for your help and your patience,
Arnau.

Return to “Building Installers”