

13:12, EET

December 13, 2016

Hi,
I am able to read the values from the server. am getting output like this
DataValue(value=780, statusCode=GOOD (0x00000000) “”, sourceTimestamp=12/16/16 10:34:02.1800000 GMT, sourcePicoseconds=0, serverTimestamp=12/16/16 10:34:02.1810000 GMT, serverPicoseconds=0)
My question is can we get like this “780” just the value. i am trying to implement read function in GUI, so i just need to read the value of tag.
Need your suggestion please!!
Thanks.
14:27, EET

Moderators
April 17, 2013

15:54, EET

December 13, 2016

17:00, EET

Moderators
April 17, 2013

13:05, EET

March 9, 2017

Hi Tony and Tahvanainen,
I am new to this stuffs, and not good in coding though, I have faced the same problem as you encountered did you get any solutions, I Can able to get the data values in normal way and I tried to use the variant method as Heikki mentioned and I have some error in that, I have posted my code and it has error
I tried like this also
DataValue value = client.readValue(NodeId.parseNodeId(“ns=5;s=Counter1”));
System.out.println(“DataValue object=” + value);
System.out.println(“value2=” + value.getValue().getValue());
I am trying to read the value from the counter1. Can you guys provide your information and this. it would be nice.
Thanks
13:35, EET

Moderators
April 17, 2013

Hi,
Please explain the error that you receive. The posted code is fine.
Without knowing more about the situation, I would guess that the error message is Bad_NodeIdUnknown “The node id refers to a node that does not exist in the server address space.”
This means that the OPC UA server in question does not contain the Counter1 node.
15:49, EET

March 9, 2017

Hi Heikki,
It works fine now I think I made some changes in the code so that the error message came. Thanks for your feedback.
Now I have another task which is I need to print the serverTimestamp as a separate output. I tried the same procedure i.e
DataValue dv = client.readValue(NodeId.parseNodeId(“ns=5;s=Counter1”));
System.out.println(“DataValue object=” + dv);
System.out.println(“value=” + dv.getServerTimestamp().getServerTimestamp());
or
System.out.println(“value=” + dv.getvalue().getServerTimestamp());
client.disconnect();
I would like to kwon how to get this
Thanks.
Most Users Ever Online: 518
Currently Online:
18 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
hbrackel: 130
pramanj: 86
ibrahim: 75
rocket science: 72
Francesco Zambon: 62
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
fred: 41
Member Stats:
Guest Posters: 0
Members: 651
Moderators: 16
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1415
Posts: 6035
Newest Members:
u310498, ntd, francescac, yahya95, leomajoe, Gus, sdfsdfsdfsd, riatucckerModerators: Jouni Aro: 988, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 941, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 25, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 288, Lusetti: 0, Ari-Pekka Soikkeli: 5
Administrators: admin: 1