I'm working on a project that allows user to download previous results but when I click the download button, it returns multiple copies of the file (20 copies) and it should be only one. I can't find where it is looping.
//Here is the code for the on select property of the button
Set(GVAR_RESULT_TYPE,1);
Set(GVAR_SESSION,ThisItem.SessionID);
Refresh(LeaderIQ_Result);
Set(GVAR_START, true);
//Here is the on timer end property for when the button is selected and here is where the flow is located.
If(GVAR_RESULT_TYPE<>2 && AppHeader_MS.Language = "English",
ClearCollect(myHTML,{htmlString:"<table class=MsoTableGrid border=0 cellspacing=0 cellpadding=0 width=483
style='width:362.05pt;border-collapse:collapse;top:345px;height:545px;left:236px'>
<tr style='height:12px;border-top:2px solid #999;'>
<td width=121 valign=top style=""font-family: 'Arial';font-style: normal;font-weight: 600;font-size: 12px;line-height: 18px;"">
Skills and
Mindsets
</td>
<td width=180 valign=top style=""font-family: 'Arial';
font-style: normal;
font-weight: 600;
font-size: 12px;
line-height: 18px;"">
Capabilities 
</td>
<td width=182 valign=top style=""font-family: 'Arial';
font-style: normal;
font-weight: 600;
font-size: 12px;
line-height: 18px;"">
How You Rated
Yourself (out of 5) 
</td>
</tr>
"});
ForAll(
Sort(galResponseIndividualRP.AllItems,Response_4.Text,SortOrder.Descending);,
Patch(
myHTML,
First(myHTML),
{htmlString: First(myHTML).htmlString&"
<tr style=""height:12px;border-top:1px solid #999;"">
<td width=300 valign=top style=""font-family: 'Arial';font-style: normal;font-weight: 400;font-size: 12px;line-height: 22px;"">
"& lblCategory_1.Text &"
</td>
<td width=180 valign=top style=""font-family: 'Arial';
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 22px;"">
" & lblSubcategory_1.Text & "
</td>
<td width=182 valign=top style=""font-family: 'Arial';
font-style: normal;
font-weight: 400;
font-size:12px;
line-height: 22px;"">
"&Text(Response_4.Text,"0.0")&"
</td>
</tr>
"})
);
Patch(myHTML,First(myHTML),{htmlString: First(myHTML).htmlString&"
<tr style=""height:12px;border-top:1px solid #999;"">
<td width=301 colspan=2 valign=top style=""font-family: 'Arial';
font-style: normal;
font-weight: 600;
font-size: 12px;
line-height: 22px;"">
Overall Average
</td>
<td width=182 valign=top style=""font-family: 'Arial';
font-style: normal;
font-weight: 600;
font-size: 12px;
line-height: 22px;"">
"& LblOverallAvrageIndividual.Text & "
</td>
</tr>
<tr></tr>
</table>"});,
Set(GVAR_HTMLTABLE,First(myHTML).htmlString);
Set(GVAR_LINK,LeaderIQV2_DownloadFilesToSharePoint.Run("Result_" & User().FullName&"_" & Text(Now(),"ddmmyyyyhhmmssam/pm") &".html",1,
LookUp(galResponseRP.AllItems,Title="Communication",Text(Response.Text,"0.0"));,
LookUp(galResponseRP.AllItems,Title="Growth mindset",Text(Response.Text,"0.0"));,
LookUp(galResponseRP.AllItems,Title="Enable Change",Text(Response.Text,"0.0"));,
LookUp(galResponseRP.AllItems,Title="Collaboration",Text(Response.Text,"0.0"));,
LookUp(galResponseRP.AllItems,Title="Develop & Coach",Text(Response.Text,"0.0"));,
LookUp(galResponseRP.AllItems,Title="Inclusion & wellbeing",Text(Response.Text,"0.0"));,
LookUp(galResponseRP.AllItems,Title="Delivering Results",Text(Response.Text,"0.0"));,
LookUp(galResponseRP.AllItems,Title="Global, business, & technical acumen",Text(Response.Text,"0.0")),
LookUp(galResponseRP.AllItems,Title="Accountability",Text(Response.Text,"0.0")),LblOverallAvrageIndividual.Text,htmlScoreTable.HtmlText,"","",AppHeader_MS.Language,"","","","").varlink);
Set(GVAR_START, false);
Set(GVAR_SHOWPOPUP,true);