I created a button that collects the values from a few text controls into a collection. Then, it uses a ForAll function to create another collection that adds an index value. That collection is then used to overwrite the original collection. I did this in order to dynamically have an index column in the collection, since I also have a button that is used to remove records from the collection. The collection is used as the data source for a gallery.
Collect(Pay_Item_Inventory, {
ID: 0,
Description: Pay_Item_Desc_Input_1.Selected.Description,
Stn_Lim: Stn_Lim_Input_1.Text,
Side_Ln: Side_Ln_Input_1.Selected.Value,
Qty: Qty_Input_1.Text,
Unit: Qty_Unit_1.Text,
Doc: Doc_Input_1.Text
});
Clear(Inventory_Indexed);
ForAll(Pay_Item_Inventory,
Collect(Inventory_Indexed, {
ID: CountRows(Inventory_Indexed),
Description: Description,
Stn_Lim: Stn_Lim,
Side_Ln: Side_Ln,
Qty: Qty,
Unit: Unit,
Doc: Doc
}
)
);
ClearCollect(Pay_Item_Inventory, Inventory_Indexed);
Reset(Pay_Item_Desc_Input_1);
Reset(Stn_Lim_Input_1);
Reset(Side_Ln_Input_1);
Reset(Qty_Input_1);
Reset(Doc_Input_1);
Everything worked perfectly yesterday. However, when I logged in today, I'm suddenly getting an error in the Collect function, that the specifed collection is an Invalid Argument Type. Furthermore, every reference to the collection throughout the app throws the same error.
I was able to narrow the issue down to the first Collect function in the above code. When I remove that portion of the code, everything works. However, I need to be able to collect the values, so removing this portion of the code is not acceptable.
I also noticed that, for some reason, the Pay_Item_Inventory collection is appearing in the Variables pane as "Variable: []" instead of "Table: 0 rows" (screenshot below) like the rest of the empty collections.
I've tried using ClearCollect(Pay_Item_Inventory, Blank()) in the OnStart property, but I get the same error that Pay_Item_Inventory is an "Invalid Argument Type."
I'm not sure why it suddenly stopped working, but any assistance would be appreciated.