- Posts: 40
- Thank you received: 1
Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Subscribing to a non-existent item
Subscribing to a non-existent item
If StrToIntDef(EventArgs.VTQ.Value,99999) <> 99999 Then ...
However I did not understand why FlotToStrDef did not work...
Please Log in or Create an account to join the conversation.
Best regards
Please Log in or Create an account to join the conversation.
If StrToFloatDef(EventArgs.VTQ.Value, NaN) <> NaN Then ...
Please Log in or Create an account to join the conversation.
But as I wrote in my 08 Jul 2021 09:27 comment, I tried to avoid
empty string values inside the DLL without any success.
Please Log in or Create an account to join the conversation.
What does not really work are the comparisons you have given as examplea:
I tried testing If EventArgs.VTQ.Value <> '' Then ...
I tried testing If EventArgs.VTQ.Value <> null Then ...
It looks like that since the Value is OleVariant, the compiled code ends up calling methods like System.Variants.VarCompareSimple, and they throw an exception in case the variant types are not equal, and it halts the program. And the variant types are often not equal, because if you are dealing with generic&multiple OPC items, they will have different type, so comparing e.g. against a string will fail with a Double, comparing against a number will fail with a string, etc.
Anyway, this underlines the fact that in order to address this, if you do not find the cause yourself, I need to have a code for the repro, and not just "guess" how exactly your code looks like.
Best regards
Please Log in or Create an account to join the conversation.
Have you tried any other String-typed item?
One from our server, OPCLabs.KitServer.2 : Simulation.Register_BSTR
One from Matrikon server, Matrikon.OPC.Simulation.1 : Random.String
Regards
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
The above only applies to certain "problematic" item(s), such as 'Bucket Brigade.UIntqa', right? In other cases, you can access EventArgs.VTQ.Value without an issue?
Regards
Please Log in or Create an account to join the conversation.
However, in the DLL, any kind of touching EventArgs.VTQ.Value will cause freezing.
Do you have any ideas for preventing this?
Are there any other flags to check?
Or maybe checking the event timestamp?
Please Log in or Create an account to join the conversation.
Regarding the freezing: I changed both my test example, and this app of yours, to access and use the EventArgs.VTQ.Value for 'Bucket Brigade.UIntqa', and it works OK in both cases.
The updated code in my example looks like this:
// Handle the notification event
if eventArgs.Succeeded then
begin
WriteLn(eventArgs.Arguments.ItemDescriptor.ItemId, ': ', eventArgs.Vtq.ToString);
if (eventArgs.Vtq.HasValue) then
WriteLn(' <', eventArgs.Vtq.Value, '>');
end
else
WriteLn(eventArgs.Arguments.ItemDescriptor.ItemId, ' *** Failure: ', eventArgs.ErrorMessageBrief);
The updated code in your example looks like this:
Edit3.text := 'Edit3 text changed unexpectedly <' + EventArgs.VTQ.Value + '>';
Regards
Please Log in or Create an account to join the conversation.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- Subscribing to a non-existent item