Given an address wildcard (for example for IecDriver: "30.*.*.*.*.*") and the datapoint name, I need to retrieve the specific _address config of that datapoint.
So I realized this solution: I execute a double step:
1- dpSet("_DriverX.AD.HWmask",wildcard) / dpGet("_DriverX.AD.DPmatch") to retrieve the list of dp names whose _address matches the wildcard
2- dpSet("_DriverX.HW.HWmask",wildcard) / dpGet("_DriverX.HW.HWmatch") to retrieve the list of addresses that match the wildcard
Then, in the list 1, I take the index of the element that matches the dp name I'm looking for. From the list 2, I take the element of the same index so I find the exact _address, because I suppose the two lists are ordered in the same way (by several tries, it seems so).
But I can experience the following problem: if, for mistake, two or more datapoints of the list has the same _address, the two lists haven't the same length, so the comparison fails.
Is there another way to do that?
Thanks in advance.
Getting _address from dp name with DPmatch/HWmatch
Search
-
- Posts: 161
- Joined: Mon Feb 23, 2015 1:34 pm
Re: Getting _address from dp name with DPmatch/HWmatch
Not sure I understood the problem. If you already have the datapoint can't you just make a dpGet for the _address.._reference?
string address;
dpGet("PUMP1.value.speed:_address.._reference", address);
string address;
dpGet("PUMP1.value.speed:_address.._reference", address);
Re: Getting _address from dp name with DPmatch/HWmatch
You are right!
I was really sure that dpget couldn't return _address config, as I read in:
viewtopic.php?f=16&t=8595&p=963721&hili ... ch#p963699
But it talks about dpQuery, not dpGet!!!
Thank you very much....
I was really sure that dpget couldn't return _address config, as I read in:
viewtopic.php?f=16&t=8595&p=963721&hili ... ch#p963699
But it talks about dpQuery, not dpGet!!!
Thank you very much....