Skip to main content
14-Alexandrite
Jan 9, 2024 9:16 AM UTC
Solved

Find element infotable CSDK

Hello,

 

I have a csdk prorgam, i need to search specific element on infotable.

I am trying to use the function twList_Foreach(twList *list, twForEachHander listHandler, void *userData) to find and update row on the infotable, but i am not succeeding.

Can someone provide me with a sample to use this method please?

my infotable contains 4 strings [field A , field B , field C , field D] , 

i am searching the row where B=='some specific string'

if true update the row.

 

Thank you very much for your help 

 

Rocko
RockoAnswer
19-Tanzanite
Jan 9, 2024 1:26 PM UTC

No working example, but the CSDK has some usages of it, just search for twList_Foreach. Some sample files using twList_Foreach are:

BindingIntegrationTests.c (in test/integration)

twInfoTable.c (in src/messaging)

 

twList_Foreach will iterate all rows, so your handler will be called for each row. Therefore you need to check for your condition B=='some specific string' in the handler (and exit/return) if it doesn't match.

You could also try to use twList_Find instead, a sample you can find in unit_twList_Find.c

1 reply

Rocko
Rocko19-TanzaniteAnswer
19-Tanzanite
Jan 9, 2024 1:26 PM UTC

No working example, but the CSDK has some usages of it, just search for twList_Foreach. Some sample files using twList_Foreach are:

BindingIntegrationTests.c (in test/integration)

twInfoTable.c (in src/messaging)

 

twList_Foreach will iterate all rows, so your handler will be called for each row. Therefore you need to check for your condition B=='some specific string' in the handler (and exit/return) if it doesn't match.

You could also try to use twList_Find instead, a sample you can find in unit_twList_Find.c

Translate