React to a change on more than one field help | ThingSpeak Apps | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
React to a change on more than one field help
Avatar
nimdixon@gmail.com
New Member
Forum Posts: 1
sp_UserOfflineSmall Offline
1
July 5, 2017 - 9:02 am
sp_Permalink sp_Print

I have a channel with 3 fields. Each field will either store a 1 or a 0, so true or false effectively.

Field 3 is a logical AND of field 1 and field 2 using the Matlab Analysis app.

What I want to do is update field 3 everytime either field 1 OR field 2 gets a new value, but I can only seem to set up one 'React' that reacts to either field 1 data insert or field 2 data insert but not both.

Any work arounds or advice would be greatly appreciated!!

 

Thanks

Avatar
cstapels

Gold
Forum Posts: 126
sp_UserOfflineSmall Offline
2
July 5, 2017 - 3:26 pm
sp_Permalink sp_Print sp_EditHistory

You could use a fourth field. Put data in field 4 each time you update field 1 or field 2.  Then trigger your react on field 4 with new data and have your matlab analysis check for data in field 1 or 2 and update field 3 based on the data check in your analysis app.

You could do something similar to this

data=thingSpeakRead(YOURCHANN#,'Fields',[1,2]); %add read api key if necessary

if isnan(data(1))

data(1)=0;

end

if isnan(data(2))

data(2)=0;

end

value=data(1) & data(2);

thingSpeakWrite(YOURCHANNEL,value,'fields',3,'WriteKey','WRITEAPIKEY'));

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
21 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

dannymm1

KamorkasOr

GRV2903

Jusikaclaiz

Raymondpoers

ScottDus

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee