Start Value dependent on previous Row

Hi All

 

First of all, first post, I haven't had to post since my appsheet debut simply because the community is so good and well made, we can find answers to our questions most of the time

 

I'm bulding an app that As a main table (RDV) and a child table (Route), this app is multiuser of course.

Now When I create a route, i want a collumn to have no start value if it's the first row for this RDV, however, I would like to be able to populate the rows only IF there is a previous Row for this RDV. 

RDV has a key of "RDV ID" but I can't figure it out... 

 

here's what I've tried so far :

I've put this code in the "Initial Value" of the collumn

 

IF(
FILTER("Route",([RDV ID]=[_THISROW_BEFORE].[RDV ID])),
LINKTOFORM("Route_Form","Route_de",[_THISROW_BEFORE].[Route_A]),""
)

 

 

 

It might not make any sense, but I am looking for directions

 

thanks a lot !

Solved Solved
0 5 123
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @JpChapron 

 

There must be a confusion on the use of [_THISRIW_BEFORE].

This must be used when it's about to get the previous value of a column, when you are updating a row.

You are probably trying to do this:

IFS(
  ISNOTBLANK(FILTER("Route",[RDV ID]=[_THISROW].[RDV ID])),

  LINKTOFORM("Route_Form",

    "Route_de",

    LOOKUP(
        MAX(
          SELECT(
            Route[_ROWNUMBER],
            ([_THISROW].[RDV ID] = [RDV ID])
            )
            ),
            "Route",
            "_ROWNUMBER",
            "Route A"
          )

    )

)

 

By the way, I suggest you have a look on this post, it's the most useful I read when it comes to dealing with rows 😉

https://www.googlecloudcommunity.com/gc/Tips-Tricks/FAQ-FILTER-LOOKUP-MAXROW-MINROW-REF-ROWS-and-SEL...

For reference:

https://help.appsheet.com/en/articles/2357267-isnotblank

https://help.appsheet.com/en/articles/2355961-ifs

 

Question: how did you manage to insert a code formatting ?

View solution in original post

5 REPLIES 5

Aurelien
Google Developer Expert
Google Developer Expert

Hi @JpChapron 

 

There must be a confusion on the use of [_THISRIW_BEFORE].

This must be used when it's about to get the previous value of a column, when you are updating a row.

You are probably trying to do this:

IFS(
  ISNOTBLANK(FILTER("Route",[RDV ID]=[_THISROW].[RDV ID])),

  LINKTOFORM("Route_Form",

    "Route_de",

    LOOKUP(
        MAX(
          SELECT(
            Route[_ROWNUMBER],
            ([_THISROW].[RDV ID] = [RDV ID])
            )
            ),
            "Route",
            "_ROWNUMBER",
            "Route A"
          )

    )

)

 

By the way, I suggest you have a look on this post, it's the most useful I read when it comes to dealing with rows 😉

https://www.googlecloudcommunity.com/gc/Tips-Tricks/FAQ-FILTER-LOOKUP-MAXROW-MINROW-REF-ROWS-and-SEL...

For reference:

https://help.appsheet.com/en/articles/2357267-isnotblank

https://help.appsheet.com/en/articles/2355961-ifs

 

Question: how did you manage to insert a code formatting ?

Hi ! Thanks so much for this you must be a wizard

 

It IS ALMOST working, however I am getting a weird, long string of text as a result... any idea why??

 

Example : Previous "Route A" = test3

Result in "Route De" for the new row 

= #control=Route_Form&defaults=%7B%22Route_de%22%3A%22test3%22%7D

The result is in there, but I need to get rid of the clutter...

thanks again

Forget it ! it's my bad for using "LINKTOFORM" I simply had to remove that from the code and it gave me what I wanted ! I will have a good read on the links you gave me !

 

thanks so much !

I didn't really pay attention to the LINKTOFORM syntax, that's my mistake. Just focused on getting the information from the row above ^^' 

I'm glad you got it eventually !

No worries, using LINKTOFORM was a mistake on my part anyway !

Top Labels in this Space