cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Coopedup
Resolver II
Resolver II

Using a variable in a Patch

Hi,

I'm creating a sequence variable from a ShowColumns / Filter search on a SP list (this is run when a button is pressed, which also navigates a new screen).

 

Set(
        TOSeqNext,
        ShowColumns(Filter(
            'Risk - SPOC',
            Register = "TO"), "Sequence")
        )

 

I want to use this in a Patch, but it keeps given an error that it is a table and not text, number, boolean....how do stop it being a table record but a text string?

Patch('SO&A - Risk Register', Defaults('SO&A - Risk Register'),
    {
    Title: "TO " & TOSeqNext.Sequence,
    'Risk Title': DataCardValue37.Text,
    'Risk Description':DataCardValue38.Text
    }
)

 

Coopedup_0-1645545846553.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Coopedup 

Yes, your variable is set to a table!

Not exactly sure what it is that you are trying to get to, but you need a value, not a table.

 

If you are trying to get the last sequence number in your variable, then you need to lookup the value.

Example:

Set(TOSeqNext,
    LookUp('Risk - SPOC', Register = "TO", Sequence)
)        

If you have some order to this, then include that as part of your lookup.

Example:

Set(TOSeqNext,
    LookUp(Sort('Risk - SPOC', Sequence, Descending), Register = "TO", Sequence)
)        

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

4 REPLIES 4
Hemzi-fcc
Helper II
Helper II

Try another period on the Sequence to see if it suggests .Value

 

 

Title: "TO " & TOSeqNext.Sequence.Value,

 

 

Edit: i think you can omit the showcolumns, including the sequence column in your filter should return only that columns value.

 

 

Filter(
            'Risk - SPOC',
            Register = "TO", Sequence)

 

RandyHayes
Super User
Super User

@Coopedup 

Yes, your variable is set to a table!

Not exactly sure what it is that you are trying to get to, but you need a value, not a table.

 

If you are trying to get the last sequence number in your variable, then you need to lookup the value.

Example:

Set(TOSeqNext,
    LookUp('Risk - SPOC', Register = "TO", Sequence)
)        

If you have some order to this, then include that as part of your lookup.

Example:

Set(TOSeqNext,
    LookUp(Sort('Risk - SPOC', Sequence, Descending), Register = "TO", Sequence)
)        

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

It gives no more suggestions and adding .Value returns another error (Name is invalid)

I couldn't see the route to the value, which is my sequence number. This has worked.

 

Thanks for taking time to look and answer. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (2,967)