Hi,
I have this problem i have a form in canvas app in which i have several tabs, and for the 2nd and 3rd tab i display a common datacard attachments. In this common datacard attachments I added the following formula in the parameter OnAddFile.
ClearCollect(
AttachmentCollection,
{
AbsoluteUri: " ",
DisplayName: " ",
Id: " ",
Name: " ",
Value: " "
}
);
ClearCollect(
AttachmentCollectionCopy,
{
AbsoluteUri: " ",
DisplayName: " ",
Id: " ",
Name: " ",
Value: " "
}
);
Collect(
AttachmentCollection,
DataCardValue117.Attachments
);
Collect(
AttachmentCollectionCopy,
AttachmentCollection
);
RemoveIf(
AttachmentCollection,
Id = " "
);
RemoveIf(
AttachmentCollectionCopy,
Id = " "
);
ForAll(
AttachmentCollectionCopy,
Patch(
AttachmentCollection,
ThisRecord,
{
Name: If( Not("Time" in ThisRecord.Name) And Not("Financials" in ThisRecord.Name), If(varTabSelected = 2, "Financials - " & ThisRecord.Name,"Time - " & ThisRecord.Name), If("Financials" in ThisRecord.Name, "Financials - " & ThisRecord.Name, "Time" in ThisRecord.Name ,"Time - " & ThisRecord.Name)) ,
DisplayName: If( Not("Time" in ThisRecord.DisplayName) And Not("Financials" in ThisRecord.DisplayName), If(varTabSelected = 2, "Financials - " & ThisRecord.DisplayName,"Time - " & ThisRecord.DisplayName), If("Financials" in ThisRecord.DisplayName, "Financials - " & ThisRecord.DisplayName, "Time" in ThisRecord.DisplayName ,"Time - " & ThisRecord.DisplayName))
}
)
);
I create myself a collection for attachments and then copy it in order to make a loop in which I will overwrite the names of added attachments.
When someone adds a new attachment, then depending on whether we are in the 2nd tab varTabSelected = 2, he wants to add the prefix "Financials", in the 3rd tab varTabSelected = 3 he adds the prefix "Time".
I also created a logic that checks if the user has already uploaded a file before, to which it overwrote, for example, the prefix "Financials" for such a case the name is to be left unchanged.
Unfortunately, this function does not work, and in the case when I add a file in the second tab it adds the prefix "Financials" to my file, but when I go to the third tab and add a file then already the new and previous file is overwritten with the prefix "Time".
Please give me some advice, do I have a bug in the logic somewhere or Patch can't handle such complex functions?
Best regards.


Report
All responses (
Answers (