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
Solved! Go to Solution.
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
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