Data Store Values Not Updating

Hi @drake,

Hi Drake,

I noticed a small issue in your code related to incrementing the counters. You’re using the post-increment operator (fdb_image_counter++ and fdb_subjectLine_counter++), which returns the value before incrementing. Instead, you should use the pre-increment operator (++fdb_image_counter and ++fdb_subjectLine_counter) to increment the values before setting them in the data store. Here’s the corrected part of your code:

if (fdb_image_counter >= fdbWeeklyImages.length) {
  await this.data.set('fdb_image_counter', 0);
} else {
  await this.data.set('fdb_image_counter', ++fdb_image_counter);
}

if (fdb_subjectLine_counter >= fdbSubjectLines.length) {
  await this.data.set('fdb_subjectLine_counter', 0);
} else {
  await this.data.set('fdb_subjectLine_counter', ++fdb_subjectLine_counter);
}

Try updating your code with these changes and see if it resolves the issue with the counters not incrementing. Let me know if you need any further assistance!
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.

1 Like