/build/static/layout/Breadcrumb_cap_w.png

Using properties in an xpath

hi,
i have an xpath that runs perfectly when i hardcode the computer name below. however if i substitute the value with a property it does not resolve.
can anyone specify the correct syntax to ensure i get the resolved property when installing:-


Working:-
/MachineInventory/Machines/Machine[@name="MyPCName"]/Attributes/Attribute[@name="City"]

Not working:-

/MachineInventory/Machines/Machine[@name="[COMPUTERNAME]"]/Attributes/Attribute[@name="City"]

what do i need to add to [COMPUTERNAME] to ensure it gets reolved?????

0 Comments   [ + ] Show comments

Answers (12)

Posted by: aogilmor 17 years ago
9th Degree Black Belt
0
Try changing COMPUTERNAME to ComputerName. Properties are case sensitive.

If that doesn't work look up the Formatted data type in msi.chm and that will show you how you can embed "[" characters. That may be the problem.

Hope this helps!
Owen
Posted by: misk 17 years ago
Orange Senior Belt
0
thx Owen, but i am afraid no joy with formatting either.
I fear i may have to use a custom action which is not what i had hoped.
with that in mind does anyone have a snippet of code that executes an xpath query and gives me the ability to store the returned value in a property so that i can use it in a component condition?
Posted by: rakesh.kumar 17 years ago
Senior Yellow Belt
0
Try using the property like this [%COMPUTERNAME%]




________________
Regards,
Rakesh.
Posted by: misk 17 years ago
Orange Senior Belt
0
tried that too, no joy! such a nightmare!
Posted by: fuz_kitten 17 years ago
Second Degree Blue Belt
0
/MachineInventory/Machines/Machine[\[]@name="[ComputerName]"[\]]/Attributes/Attribute[\[]@name="City"[\]]

From Formatted

If a substring of the form [\x] is found, it is replaced by the character x , where x is one character, without any further processing. Only the first character after the backslash is kept; everything else is removed. For example, to include a literal left bracket ([), use [\[]. The text [\[]Bracket Text[\]] resolves to [Bracket Text].

What does the log resolve [ComputerName] to?
Posted by: misk 17 years ago
Orange Senior Belt
0
thx for the help.
when looking at the log it seems as if the CA ISXmlAppSearch does not attempt to resolve the string whatsoever.

for example if i set the Element column of the ISXmlLocator table to any of the following it does not get resolved and shows up character for character in the lof.

Value in table What appears in log as element value to look for
[ComputerName] [ComputerName]
[%ComputerName%] [%ComputerName%]
[\[]ComputerName] [\[]ComputerName]
[[ALLUSERS]] [[ALLUSERS]]

It is as if no attempt is made to resolve any part of the expression when using the xml app search.
Can anyone confirm this?
Posted by: fuz_kitten 17 years ago
Second Degree Blue Belt
0
I'm sorry but I've never used the ISXmlAppSearch table. Where is the CA scheduled? Is it deferred?
Posted by: jmcfadyen 17 years ago
5th Degree Black Belt
0
are you using the default WIX xml CA's ?

I have a bunch of examples for that which use almost identical syntax. Let me know if you want them .
Posted by: misk 17 years ago
Orange Senior Belt
0
i am using installshield 8 which adds in the CA xmlappsearch. the problem is that it does not resolve the xpath string. if you have some examples that can sort my problem i would appreciate it
Posted by: misk 17 years ago
Orange Senior Belt
0
just to let anyone know we called installshield on this issue and it turns out that the IS custom action that is used when you create an xml appsearch does not resolve the xpath it is passed. therefore what i was trying to do would never work!
Posted by: jmcfadyen 17 years ago
5th Degree Black Belt
0
//configuration/appSettings/add[\[]@key='azmanStore'[\]]/@value

//FormManagement/ReplaceItems/ReplaceItem/NewUrl

//appSettings/add[\[]@key='AUDIT_QUEUE'[\]]/@value

//MonitoredProcessStartInfo[\[]ProcessName='ISS RuleBase'[/]]/EnvironmentVariables/Parameter[\[]@key='SSAMSQBIN'[/]]/@value

//configuration/applicationSettings/SIS.Framework.Auditing.MsmqDistributor.Properties.Settings/setting[\[]@name='AuditQueuePath'[\]]/value
Posted by: jmcfadyen 17 years ago
5th Degree Black Belt
0
try a single ' around the "[Computername]"

ie

'[Computername]'
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ