I appreciate that there are several queries of this type, but unfortunately none of them solve my particular issue as far as I can tell.
Apologies for the lengthy description-I just want to be clear on what's going wrong.
I have a collection, Col_CostAnalCompare_Test, which pulls in all data from a static Excel table, CostAnal, when my app starts. The relevant material is attached.
A separate collection, Col_UserCompare, also pulls in data from a static Excel table, Benchmark_Test, when the user selects a project that they are interested in comparing (see the 'value_if_false' argument in the if statement below).
If(ThisItem.Description exactin Col_UserCompare.Description, Remove( Col_UserCompare,
Filter( Col_UserCompare, Description=ThisItem.Description ) )
,
Collect(
Col_UserCompare,
{
Name:Name,
Description: Description,
Project_Sum: Project_Sum,
Quality_Rating: Quality_Rating,
New_Build_Or_Refurbishment:New_Build_Or_Refurbishment,
Airside_Or_Landside:Airside_Or_Landside,
Lead_Designer:Lead_Designer,
Principal_Contractor:Principal_Contractor,
Procurement_Route:Procurement_Route
}
))
Benchmark_Test and CostAnal are 2 separate tables, but they each feature a column with a Project_ID. So the Project_ID 'T_DL_1' from Benchmark_Test (and therefore Col_UserCompare) will match a Project_ID from CostAnal (and therefore Col_CostAnalCompare_Test).
If the user has selected a project to compare, then the following code looks at Col_CostAnalCompare_Test and presents all records (there are multiple cost entries per project in Col_CostAnalCompare_Test, see the excel for details) where the Project_ID matches the Col_UserCompare_Test Project_ID.
Filter(Col_CostAnalCompare_Test,Project_ID exactin Col_UserCompare.Project_ID)
Still with me? Hold tight.
The above code is entered into a gallery, under 'Items'. BUT the actual cost data, derived from Col_CostAnalCompare_Test, is displayed in a subgallery (I tried multiple ways of doing this and this was the only one that permitted scrolling from left to right).
So you have a gallery with multiple subgalleries. Each subgallery contains cost data.
But...the subgalleries repeat, seemingly infinitely, within the main gallery. See the attached screenshot. T_DL_1 is shown on the left, followed by T_DL_2 (this is fine, as these are 2 separate projects). But then, as the user scrolls right, T_DL_1 appears again, followed by T_DL_2, followed by T_DL_1...you get the idea.
Why is this? I tried to implement the
Last(FirstN(source, number)) solution that I saw elsewhere (yes, I've searched for a fix pretty hard) but I am not sure my own situation is compatible with this.
Apologies if any of the above is irrelevant to the repeating gallery situation, but I just wanted to give some context in case it's important.
Any assistance would be much appreciated.
Do you mean that Col_UserCompare has duplicate data?
Actually, I think what you described is a little complex, so I couldn't quite understand the process.
Could you show me
1)the formula that how do you update Col_UserCompare collection?
2)the items property of the gallery?
You just need to tell me the related information about your issue, no need to describe so detailed.
I suggest you firstly describe how this function works and then show me related formulas.
At last, describe your problem.
Best regards,
Hi, sorry for the lack of clarity.
Col_UserCompare does not contain duplicate data. The horizontal gallery displays infinite subgalleries (each of which display data derived ultimately from Col_UserCompare, but I don't think the data is the cause of the issue.
<quote>
1)the formula that how do you update Col_UserCompare collection?
</quote>
When the 'Add this project to comparison list' button is selected, the following 'Onselect' code is run.
Collect(Col_UserCompare,Filter(Col_SelectedProjects,ThisItem.Description exactin Description)))
<quote>
2)the items property of the gallery?
</quote>
The 'Items' property of the main gallery is as follows:
Filter(Col_CostAnalCompare_Test,Project_ID exactin Col_UserCompare.Project_ID)
The 'Items' property of the subgallery, nested inside the main gallery, is as follows:
Filter(Col_CostAnalCompare_Test,Shown=true,Project_ID=ThisItem.Project_ID)
My issue is that the gallery repeats the subgalleries over and over again.
So if Project_1 is contained in the Col_UserCompare, the main gallery's records show lots of subgalleries, with each subgallery showing the cost records for Project_1.
If Project_1 and Project_2 are contained in Col_UserCompare, then the main gallery displays the subgallery (containing the cost records) for Project_1, then the subgallery for Project_2, then it repeats (Project_1, Project_2,Project_1,Project_2 etc).
I am trying to find a way to eliminate the duplication, so that if Project_1 is contained within Col_UserCompare, then the main gallery should only show 1 subgallery: the cost records for project 1.
Likewise, if Project_1 and Project_2 and contained within Col_UserCompare, then the main gallery should show 2 subgalleries: Project_1 and Project_2.
I note that changing the 'items' property of the main gallery to just Col_CostAnalCompare_Test does not solve the issue described below, since the main gallery repeats the subgalleries just the same. Of course, without the filter, it displays all projects in the Col_CostAnalCompare collection. There are currently 3 projects in this collection, so it repeats Project_1, Project_2,Project_3,Project_1,Project_2, etc.
I trust this is more helpful than the initial description I gave, but do please let me know if any further info is required.
Thanks.
User | Count |
---|---|
140 | |
136 | |
77 | |
75 | |
69 |
User | Count |
---|---|
224 | |
186 | |
68 | |
64 | |
57 |