在PowerApps中,我如何从SharePoint列表中获取多选的选定值的集合而不使用ComboBox
我有一个具有多选择列的SharePoint列表。 在PowerApps中,我想收集选定的值。
例如,我有一个名为“类别”的多选择列,该列有一个,二,三和四的选择。 我选择了两个和四个。
我的PowerApps集成形式OneDit中的代码是,
Clear(myCollection);
ForAll(Choices([@SMEList].Category), Collect(myCollection,ThisRecord.Value));
但这给了我一个,二,三和四。 我只想要选定的值(两个和四个)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这项工作:
插图:
编辑1
应用程序的
,clearCollect(collist,< sp_list_name>)
item
属性设置为collist。将其
OnSelect
属性设置为set(varrecord,thisEtem)
item
属性设置为lookup(collist,ID,ID) = varrecord.id)
插图
编辑2
re:
...从SharePoint列表中获取它。
instart
函数clearcollect(collist,sharepointlist)
项目
属性collist
text
属性属性concat(thisitem.smelist,value,',',”)
displaymode
combobox的属性为view
。This works:
Illustrated:
EDIT 1
OnStart
of the app,ClearCollect(colList, <SP_list_name>)
Items
property tocolList
. Set itsOnSelect
property toSet(varRecord, ThisItem)
Item
property toLookUp(colList, ID = varRecord.ID)
Illustrated
EDIT 2
RE:
...just get it from the sharepoint list .
OnStart
function toClearCollect(colList, SharepointList)
Items
property tocolList
Text
property toConcat(ThisItem.SMEList, Value, ",")
DisplayMode
property of the ComboBox toView
.我将假设
[@smelist] .category
表示您在“ smelist”上有“类别”的查找列。您说您想要一个不使用组合盒的收藏品吗?但是,您只需要选定的值,那么如果不是从盒子中选择这些值,这些值在哪里?即使您不希望用户弄乱框,也可以将其设置为禁用,查看或可见= false。因此,我将包括那条路线,然后再谈论直接从列表中获取值。
组合框
或可能是:
这将使您将所有选定的值拉在一起。因此,它将进行:
或者,使用组合框的
onChange
:每当更改任何选定的项目时,会自动更新集合。
可能已经拥有。)
(并且在应用程序的onstart中,做
set( mycollection
,[])您 开始,在应用程序的Onstart中,例如:
...基于ID,您致电该集合以获取其值,例如Seadude使用画廊演示,然后他使用结果设置了一个组合盒,基本上是关键是:
查找(Collist,id = varrecord.id)
其中
varrecord
将其设置为thisEtem
从列表中:Gallery的OnSelect属性:
set set (varrecord,thisitem)
...因此,它设置了画廊正在调用的项目。 项目使用该
lookup
公式,上面是。(然后,他将该项目设置为相当于组合框的
发送ID并将其所有列的整个项目返回。您可以使用
查找
命令可以做很多事情,如果您直接违反列表,而没有ID,也可以:clearCollect(myCollection,lookup,lookup([@smelist), “创建”&lt; today())。'类别')
...可能会在该
smelist
上可能抓住您的每个类别> 。您可以使用所需的任何条件(ID等于某物,标题等于某物等)。
任何方向
获得收藏后,您可以在
countrows
上进行mycollection
以查看必须查看多少值,以查看它是否匹配什么您期望:I'm going to assume that
[@SMEList].Category
indicates you have a Lookup column of "Category" on "SMEList".You say you want a collection without using a combo box? Yet, you only want the selected values, so where are these getting selected, if not from a box? Even if you don't want the user to mess with the box, you can set it to disabled, view or visible = false. So I'm going to include that route and then also talk about getting the values from the list, directly.
Combo Box
or it might be:
This would let you pull all selected values together. So it would go:
Or, using the
OnChange
of the combo box:Automatically updating the collection whenever any selected items are changed.
(And in the App's OnStart, do
Set(myCollection, [])
as you probably already have.)Without a combo box
You could also set the list into a collection from the beginning, in the App's OnStart, like:
...and based on an ID, you call to that collection to get its values, like SeaDude demonstrated using a gallery and then he set a combo box using the result, basically the key was:
LookUp(colList, ID = varRecord.ID)
Where
varRecord
was set toThisItem
from the list:Gallery's OnSelect property:
Set(varRecord, ThisItem)
...So it sets the item that the gallery was invoking. (And then he set that item equal to the combo box's
Items
property using thatLookUp
formula, above.)But that code takes the collection with the list in it and lets you send in an ID and get the whole item, with all of its columns, back out. You can do a lot with a
LookUp
command just on its own if you are going against a list directly, and without an ID, too:ClearCollect(myCollection,LookUp([@SMEList],'Created'<Today()).'Category')
...could potentially grab you every
Category
value on thatSMEList
that was Created before today. You can use any condition you want (ID equals something, Title equals something, etc.).Either direction
After you get your collection, you can do a
CountRows
on yourmyCollection
to see how many values it has to see if it matches what you expect: