I'm working with an app where I want to hide a dropdown value if it's already selected in another row..
for example, i want to hide winch drum in dropdown, because it was selected in 1st row.
Collect(
col_Main,
{Value: ""}
);
ClearCollect(
col_ForDropdown,
Table(
{
Value: "A",
Added: false
},
{
Value: "B",
Added: false
},
{
Value: "C",
Added: false
},
{
Value: "D",
Added: false
},
{
Value: "E",
Added: false
},
{
Value: "F",
Added: false
},
{
Value: "G",
Added: false
}
)
);
Hi @karthik26 , Basically, I have 2 collections: col_Main and col_ForDropdown.
col_Main: This is used as Item property of your gallery. In your case it will be same data source or collection that you are creating on click on Add button.
col_ForDropdown: This is used as Item property of dropdown, but in different way.
OnSelect of Add button, I have below code:
Collect(
col_Main,
{Value: ""}
);
OnVisible of Screen, i have this code: In your case it should be items that you might be pulling it from some source with distinct values. In top of that I have added one more column named as Added.
ClearCollect(
col_ForDropdown,
Table(
{
Value: "A",
Added: false
},
{
Value: "B",
Added: false
},
{
Value: "C",
Added: false
},
{
Value: "D",
Added: false
},
{
Value: "E",
Added: false
},
{
Value: "F",
Added: false
},
{
Value: "G",
Added: false
}
)
);
Now the AllowEmptySelection is true for dropdown which is within your gallery.
The Default of dropdown is ThisItem.Value
OnChange Property of dropdown is
Update(
col_Main,
ThisItem,
{Value: Self.Selected.Value}
);
Update(
col_ForDropdown,
LookUp(
col_ForDropdown,
Value = Self.Selected.Value
),
{
Value: Self.Selected.Value,
Added: true
}
);
NOTE: col_Main collection, I have only one column Value, in your case you need to have all columns which is required.
And the Item property of your dropdown will be:
If(
ThisItem.Value in col_ForDropdown.Value && LookUp(
col_ForDropdown,
Value = ThisItem.Value
).Added = true,
col_ForDropdown,
Filter(
col_ForDropdown,
Added = false
)
)
So basically, I am patching the selected value as true in Added column and then based on selection , I make the Item property dropdown in conditional way.
Again, you need to work on this code as per your requirement.
-----------------------------------------------------------------------------------------------------------------------------
I hope this helps.
Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍
Thanks,
ANB
Hi @karthik26 , Please confirm whether this is what you are looking:
If yes, then it is little tricky but I can explain the code and you might have to manage it according to your own code.
I am also using gallery and within that the dropdown.
-----------------------------------------------------------------------------------------------------------------------------
I hope this helps.
Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍
Thanks,
ANB
Sorry, i will explain clearly.
I have a gallery where I enter measurement data. The data is saved to SharePoint.
the data source of a gallery is a collection(colactualdia), on visible to screen this collection is created.
ClearCollect(
colactualdia,
'GOM L&H-Wire Rope Actual Diameter'
);
i have added a dropdown and text inputs in gallery were user will enter the measurements.
for dropdown items propert i used.
i used a button called ADD to adda new blank row in gallery.
What i want is hide the value in dropdown , in next row once user is selected it in some other row.
i want to hide gantry sheave 1, in dropdown value of next row. Because it is already selected .
Hi @karthik26
Utilize the collection function in the OnChange property of the first Dropdown control to gather items with values that are not equal when select in first dropdown.
ClearCollect(
filterdrp,
Filter(
Datasource,
!(Dropdown1.Selected.Value in Choicecolumn.Value)
)
)
2nd dropdown item property : filterdrp
This may help you.
Thanks!
If my response has been helpful in resolving your issue, I kindly request that you consider clicking "Accept as solution" and "giving it a thumbs up" as a token of appreciation.
i think you got it wrongly.
Want i want is if any value selected in dropdown(Winch drum) already, i want that particular value(winch drum) to hide from dropdown.
To do this, you will need to make sure that your drop down selection allows Empty selection:
Clear out the Default property
Then, Set the Visible Property to
Len(Self.Selected.Value) = 0
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Cheers!
Rick Hurt
WarrenBelz
146,524
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,906
Most Valuable Professional