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,692
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