cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BlessedCobba
Resolver I
Resolver I

Updating Sharepoint Data

Hi,

 

I've run into this problem a few times and wondering what the best way to solve my problem.
I am patching 4 pieces of information to a SharePoint list. Country, Team, Roles, Value.
I then want users to be able to update the value after they have saved it. 

The issue that i'm having is that the teams in all countries are named the same and the roles are also the same. so to find the right row to update i need to match 3 pieces of unique information and i am unable to get the patch to look up and match 3 pieces of information

 

Cheers

6 REPLIES 6
WarrenBelz
Super User III
Super User III

HI @BlessedCobba ,

Maybe I am missing something here, but would you not simply match Country? What code are you using to find the Update?

Lukas1
Advocate II
Advocate II

Hi @BlessedCobba ,

you can combine multiple filters with logical operators like "&&" (And) and "||" (Or).

 

So if three values have to match you could use:

UpdateIf(
    TableName,
    Country="CountryName" && Team="TeamName" && Roles="RolesName",
    {
        ColumnToBeEdit:NewValue
        ....
    }
)

 

The column "Roles" sound as if there are multiple roles stored in one string. If that's the case and you don't want to compare the whole string but only want to check whether one particular role is mentioned in the string try this:

UpdateIf(
    TableName,
    Country="CountryName" && Team="TeamName" && "RolesName" in Roles,
    {
        ColumnToBeEdit:NewValue
        ....
    }
)

 

BlessedCobba
Resolver I
Resolver I

@Lukas1I was trying to get away from having separate buttons to save and update if possible

 

@WarrenBelzThis is an example of the data structure, the way i have to build the input screen you only update the values for a single team at a time.
so if i just do the country it will just write over the first team it finds
if i do team it will just do the first one it finds and same problem with the role

BlessedCobba_0-1614299050252.png

 

Lukas1
Advocate II
Advocate II

@BlessedCobba , you can also use multiple filters (separated with && or ||) in the Patch-function.

@Lukas1 ,

I will leave you to supply the actual code you are suggesting to @BlessedCobba .

Lukas1
Advocate II
Advocate II

@BlessedCobba , not quite sure if this is what you are looking for but maybe it helps:

//Check if item with selected country, team and roles already exists:
If(IsBlank(TableName,Country="CountryName" && Team="TeamName" && Roles="RolesName"),

//If not, create new item
Collect(
    TableName,
    {
        Country:"CountryName,
        Team:"TeamName,
        Roles="RolesName"
        ....
    }
)

//Else, update existing item
UpdateIf(
    TableName,
    Country="CountryName" && Team="TeamName" && Roles="RolesName",
    {
        ColumnToBeEdit:NewValue
        ....
    }
)

) //End If

 

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (43,599)