Hi all!
In my account, I have a data store called Weekly Lineup Counters (screenshot). I reference this data store in two different workflow actions, with variations of the following code:
// import...
export default defineComponent({
props: {
data: {
type: "data_store",
label: "Weekly Lineup Counters"
},
},
async run({ steps, $ }) {
// Helper functions...
let fdb_image_counter = await this.data.get('fdb_image_counter');
let fdb_subjectLine_counter = await this.data.get('fdb_subjectLine_counter');
const fdbWeeklyImages = [
"https://pacayadigital-creativelive.s3.us-west-2.amazonaws.com/weekly-lineup/FDB/FDB_WeeklyLineup_Heros_01.jpg",
"https://pacayadigital-creativelive.s3.us-west-2.amazonaws.com/weekly-lineup/FDB/FDB_WeeklyLineup_Heros_02.jpg",
"https://pacayadigital-creativelive.s3.us-west-2.amazonaws.com/weekly-lineup/FDB/FDB_WeeklyLineup_Heros_03.jpg",
//...more images...
];
const fdbSubjectLines = [
"What to discover this week (for free). // Your personal recommendations.",
"Your recommended live classes. //Turn this week into anything.",
"Your personal recommendations. // Live, free, picked for your goals.",
// more subject lines...]
// Code to create campaign object...
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++);
}
},
})
What I am trying to achieve with the data store is the ability to run-by-run increment through the images and subject lines arrays. What I am finding is that the data store values are not incrementing, and I’m not sure why based on the docs and answers from Pi.
I am hoping you can help me figure this out as it seems likely to be user error, and I’d love to get it resolved, both for this and future data store use cases.
Thank you in advance!
Drake
