From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
07-14-2021 05:57 AM - edited 07-14-2021 05:58 AM
Hi guys, I will be referring to the following example:
The example works fine, I have no issues with it.
I'm trying to edit the example, so I don't need to physically press the button, instead, have it done programmatically.
To test it, I just created an additional While Loop, inside it, a Flat Sequence, and every 3 seconds I'm setting the Update button to true, then again to false (I had to change the mechanical action from latch to switch though).
When I press the button, the value is inserted, but every time the value of the button is changed programmatically, nothing happens...
Could someone explain why this isn't working?
I'm attaching the edited example.
Cheers,
Johnny
Solved! Go to Solution.
07-14-2021 06:07 AM
Hi Johnny,
@JohnatanBravo wrote:
When I press the button, the value is inserted, but every time the value of the button is changed programmatically, nothing happens...
Changing the value of a control by user actions generates a ValueChange event, but setting the values programmatically (using local variables or "value" properties) does NOT generate a ValueChange event… (Basic knowledge about event structures!)
The quick&dirty solution is to use a "value (signalling)" property as that one will also generate the desired ValueChange event… (Beware of side effects!)
07-14-2021 06:30 AM - edited 07-14-2021 06:40 AM
Thank you, it's working now.
I'm only going through Core 1 at the moment, and wasn't aware of that.
Could you elaborate on the side effects? What are the possible side effects of doing this?
I'm only updating some test info using this, I don't see any possible bugs...
Working example attached.
Cheers,
Johnny
07-14-2021 06:41 AM
Hi Johnny,
@JohnatanBravo wrote:
What are the possible side effects of doing this?
Each time you write to a "value (signalling)" property node an event is triggered - regardless if the value has changed or not…
07-14-2021 07:26 AM
That's good to know, thanks again.
Cheers,
Johnny
07-14-2021 09:45 AM
@GerdW wrote:
Hi Johnny,
@JohnatanBravo wrote:
What are the possible side effects of doing this?
Each time you write to a "value (signalling)" property node an event is triggered - regardless if the value has changed or not…
As a side note, inside an XControl, a "Data Change" event will be triggered only if the value is different.