Hi Community,
I have an issue with data values showing correctly after using the Collect function. For background, I have a list of records for a year, when a new year comes there is an icon to add the new year. On select, it brings a dialog asking user to input what year they would like to copy. User inputs the year to copy. What it should do is grab the selected record year records, update with the new year and then add an option with new year to gallery, select the new year, and list of records should appear with the new date.
Adding a new year works great. However. when I select the new year from gallery, it appears to have all the records, except there are field data missing and the start date is not updated to the new year.
If I use the below query, it does seem to grab the data, creates a new year but some columns are missing and the Start Date is not updated.
UpdateContext({varYearSelected: cpt_Home_YearDialog_.ValueProvided & "0101"});
Set(
gvarYearCopy,
Value(varYearSelected)
);
ClearCollect(
colYearCopyBase,
Filter(
'[dbo].[Test]',
StartDateInt = gvarYearCopy
));
ClearCollect(
colYearCopy,
DropColumns(
colYearCopyBase,
"StartDateInt"
)
);
UpdateContext({varCopyStatus: "Formatting Data"});
UpdateIf(
colYearCopy,
true,
{
StartDate: DateAdd(
StartDate,
1,
Years
),
UniqueID: Blank()
}
);
UpdateContext({varCopyStatus: "Creating New Year Records"});
Collect(
'[dbo].[Test]',
colYearCopy
);/*
Clear(colYearCopy);
Clear(colYearCopyBase);*/
However, when I made a new collection with the value explicitly in the expression, all the data fields render as expected.
ClearCollect(
colTEST,
Filter(
'[dbo].[Test]',
StartDateInt = Value("20200101")
)
);
Why does it only return all column values if I set the StartDateInt = to a hard-code value, which is not a feasible option as the year to copy will change regularly.
Appreciate any insights and assistance that can be provided here