How to pre populate a field in a form using a Behaviour Action?

Hi All,
I want to populate an Enum type column with a specific value when I enter the form view. The form view is entered through the โ€˜Behaviour actionโ€™ - โ€˜App: Go to another view within the appโ€™. I selected โ€œLINKTOFORMโ€ expression to gain access to the form view (I know there are other ways to enter a form, but in my app, this โ€˜behaviour actionโ€™ is what I specifically want to use to enter in to the form view). The form has an โ€˜Enum type columnโ€™ called [Station] which has a list of hospitals in the country assigned to it via a โ€˜Data Validityโ€™ - โ€˜ValidIfโ€™ expression (The Google Sheet has a table called โ€œUroStationsโ€, in it thereโ€™s a column called โ€œStationsโ€ that has the list of Urology Stations in the country, and this is the column that populates the [Station] column in the form view).
The functionality of the app goes like thisโ€ฆ The app first shows a view (A card type view) that allows the user to select the Urology Station (for this purpose, the card type view uses the โ€œUroStationsโ€ tableโ€™s [Stations] columnโ€™s values), and when the user selects a specific station, the detailed view of this specific row is brought up and it has few โ€œBehaviour actionsโ€. One of the behaviour actions is to โ€˜Create a new entryโ€™ using the form view, and what I want is this form viewโ€™s [Station] Enum type column (which is a pull down menu which has all the Urology stations in the country) to just show the specific โ€˜Stationโ€™ that user initially selected from the app in the first view, so that the user doesnโ€™t have to select the โ€˜Stationโ€™ again.
Is this possible? I tried LINKTOFORM(โ€œPatient Details Tableโ€,โ€Stationโ€,[_THISROW].[Stations]), but this didnโ€™t work.
Ironically, when I enter the table view through a Behaviour Action called โ€œLINKTOFILTEREDVIEW(โ€œPatient Details Tableโ€,[Station]=[_THISROW].[Stations]) expression, and then proceed to add a new entry through the table by tapping on the + button, then the form view gets populated with the specific station. What Iโ€™m trying is to directly enter the form view without having to go through the table. Do let me know if thatโ€™s possible.
Thanks

0 14 1,719
14 REPLIES 14

It sounds like you should be just about there with your bolded formula. Maybe just a typo but I think you need to remove the โ€˜sโ€™ from the last โ€œStationโ€.

LINKTOFORM(โ€œPatient Details Tableโ€,โ€Stationโ€,[_THISROW].[Stations])
to
LINKTOFORM(โ€œPatient Details Tableโ€,โ€Stationโ€,[_THISROW].[Station])

Is this โ€œPatient Details Tableโ€ your form viewโ€™s name? When you are using LINKTOFORM deep link, you need to use the form name. Another reason could be the column nameโ€ฆ like โ€œStationโ€ needs to be exactly the same than in your table and itโ€™s case sensitive. Finally the [_THISROW] is not needed so you can type it just [Station].

Yes, thatโ€™s the form name, and the formโ€™s enum column is called โ€œStationโ€. When the app starts up, Iโ€™m in โ€œUroStationsโ€ table, and in that, the column called โ€œStationsโ€ has a list of hospitals. I have displayed these list of hospitals in the โ€œStationsโ€ column as a card view, and when I select a card, I go to the detail view of that value (now the view is Stations_Detail). When Iโ€™m in the Stations_Detail view, there are a set of behavior actions in it displayed as buttons. When I tap the โ€œNew Entryโ€ button, I want to display the new entry form view (form viewโ€™s name is โ€œPatient Details Tableโ€) with the โ€œStationโ€ enum type pulldown menu in this form pre-populated with the same hospital name that I was in when I was in Stations_Detail view.
But somehow this doesnโ€™t work.

Are both โ€œStationโ€ columns Enum fields?

One in the โ€œUroStationsโ€ table is called โ€œStationsโ€. In the Google Sheet, this โ€œStationsโ€ column has a list of hospitals. In the App, this is the starting point of the app showing these list of hospitals because I have made โ€œUroStationsโ€ table as the starting point of the app, and made it as a card view. When I select a card (which means a hospital name), I go to the detail view of it. So I have not converted it to an enum type column, that column inside the app has been a text type column, because it doesnโ€™t really matter for it to be an Enum type column is it, since I use the โ€œUroStationsโ€ table to display a set of hospital names at the start of the app.
But in the โ€œPatient Details Tableโ€ (which I have displayed as a form view in the app), thereโ€™s a column called โ€œStationโ€, and it is an Enum type column and it is the one that has the ValidIf expression written to it to bring down the same set of hospital names from the โ€œStationsโ€ column in the โ€œUroStationsโ€ table - the ValidIf expression I wrote is UroStations[Stations]. That bit works fine. When I hit the button โ€œNew Entryโ€, it brings down the โ€œPatient Details Tableโ€ form view too. What I want is to pre-populate that โ€œStationโ€ column with the same hospital name that I was in. Looks like itโ€™s undoable. I tried many a time, but failed.

What is your account ID and app name if I check your app structure?

It appears that, LINKTOFORM expression doesnโ€™t recognize the columns in the form view. I tried writing โ€œStationโ€ as [Station], and it says it cannot find a column called [Station], when in fact in the form view, thereโ€™s a column called [Station].

SLAUSDatabase-838512

I have given a hypothetical name for the form view here called โ€œPatient Details Tableโ€, when in fact the form view name in the app is called โ€œNew Entryโ€ and this form view is based on a table called โ€œPersonal Detailsโ€, I didnโ€™t put that here in case you got confused.

At least this is wrongโ€ฆ LINKTOFORM(โ€œNew Entryโ€,โ€œStationโ€=[Stations]) should be
LINKTOFORM(โ€œNew Entryโ€,โ€œStationโ€,[Stations])

Whoa, now it works!!! I guess taking off the [_THISROW] did the trick. That is the only combination I didnโ€™t try! Thank you Aleksi!

The main reason was the โ€œNew Entryโ€=[Stations]

But actually having [_THISROW] made it NOT work. I just tried again with [_THISROW] in it, and it didnโ€™t work! When I took it off, it works! Thank you very much for this.

Yes thatโ€™s true.

Top Labels in this Space