When I press a button I want to change the status of a list. So:
Save button - changes status to draft - OnSelect - UpdateContext({locStatus:false});
Submit button - changes satus to submit - OnSelect - UpdateContext({locStatus:true});
On the forms datacard that cotains the status column - Update - If(locStatus,{Value:"Draft"},{Value:"Submitted"})
Now, this only works when the type of the column is Choices, but my type is a Lookout to another sharepoint list in which that column contains 2 row (draft and submitted), how do i make this formula to work in my case?
Solved! Go to Solution.
Hi @Robert94 ,
Neither form - you need to look up the List with the Title field you mentioned - also note Id, not ID in the reference.
With(
{
wStatus:
If(
locStatus,
"Draft",
"Submitted"
)
},
{
Id:
LookUp(
YourStatusListName,
Title = wStatus
).ID,
Value: wStatus
}
)
A better idea is to ask yourself why you are using Lookup columns (I have not used them for many years) unless you want to interact with the field directly in SharePoint - I have a blog on Data Structure that may interest you.
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.
Visit my blog Practical Power Apps
Hi @Robert94,
Do you mean that the Status column is a LookUp column retrieving values from another SP list?
Could you please share a bit more about your scenario?
If the Status is indeed a LookUp column, you should modify your formula as below:
If(locStatus,
{
Id:LookUp(AnotherSPList,Status="Draft").ID
Value:"Draft"},
{
Id:LookUp(AnotherSPList,Status="Submitted").ID
Value:"Submitted"}
)
HI, so there are 2 forms, one main called MasterForm, one for the Status called StatusForm,
in the MasterForm there is a column called Status, its a Lookout type to the Title column of the StatusForm, the title column of the StatusForm has 2 rows, called Draft, and Submitted.
On screen the Forms data source is MasterForm.
What I want:
-when pressing Save button : Status of the form changes to Draft, and then Submits the form.
-but if pressing Submit button: Status should change to Submitted, and then Submits the form
Why?
- I will use a filter for a MasterForm gallery to filter items by the Status, Draft or Submitted.
I can.t make your formula to work, if you could help me more. Thank you.
This is how I wrote it
If(locStatus,{ID:LookUp(StatusForm, Status="Draft").ID, Value:"Draft"},{ID:LookUp(StatusForm, Status="Submitted").ID, Value:"Submitted"})
Shouldn`t the If function be addressed to the MasterForm instead of the StatusForm?
Hi @Robert94 ,
Neither form - you need to look up the List with the Title field you mentioned - also note Id, not ID in the reference.
With(
{
wStatus:
If(
locStatus,
"Draft",
"Submitted"
)
},
{
Id:
LookUp(
YourStatusListName,
Title = wStatus
).ID,
Value: wStatus
}
)
A better idea is to ask yourself why you are using Lookup columns (I have not used them for many years) unless you want to interact with the field directly in SharePoint - I have a blog on Data Structure that may interest you.
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.
Visit my blog Practical Power Apps
Hi @Robert94 ,
Just checking if you got the result you were looking for on this thread. Happy to help further if not.
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.
Visit my blog Practical Power Apps
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
205 | |
97 | |
60 | |
51 | |
45 |
User | Count |
---|---|
256 | |
158 | |
87 | |
79 | |
58 |