Show columns based on a certain fields

Hi All

Im looking at a way to have certain data hidden and only visible when the correct password is added.

For this I'm using a table view "Data" with lots of columns and I also have a Form "PW" with 2 columns for [Name] and [Password]. I was hoping by adding a pre set name and password that the data would show.

I have tried using the Show_If filter on the "Data" table for the columns I want to hide: AND(PW[Name]=USER1),(PW[Password]=1234) ... then adding these in the form, but that didn't work.

Ive also tried to make a slice of the "Data" table that hides the whole table with the same formula... again no joy!

I have created a dashboard view with both the "PW" form and the "Data" table so I could test this and it isn't affecting the table view. Sorry if this sounds like Im stupid... but could anyone help please - tearing my hair out!!

Thanks In Advance

 

 

Solved Solved
0 12 346
1 ACCEPTED SOLUTION

The examples in the expression I gave were all for opening a Form for a NEW row.   I did mention...


@WillowMobileSys wrote:

NOTE: there are other navigation functions you can use check the article for those other functions.


You can navigate to basically any view and showing any data you wish.

LINKTOFORM()

At the bottom of the above article are all of the other navigation functions available.  Check them out.

View solution in original post

12 REPLIES 12


@marsbar wrote:

AND(PW[Name]=USER1),(PW[Password]=1234)


This is the right approach but the AND() function is just not used correctly.  As I understand it, you are using the expression in the Show_If of other columns on this same Form, showing the column only once the correct Name and Password are entered.

For that you would want to use this expression placed into EACH other columns Show_If:

AND([Name] = USER, [Password] = 1234)

I hope this helps!

Thanks very much for this, very close... what I was wanting was to have the User/Password on a form that then unhides columns on a separate table.

Form would be "PW" and the Main table with the columns would be "Data" in this case.

I tried using AND(PW[Name] = USER, PW[Password] = 1234) in the SHOW_IF Formula on a test column on "Data" and it threw back a "Cannot compare List with Text in (PW[Name] = "USER")" error. The column was actually set as TEXT. Any ideas please??


@marsbar wrote:

Thanks very much for this, very close... what I was wanting was to have the User/Password on a form that then unhides columns on a separate table.


In the context of AppSheet, this doesn't really make sense.  You cannot show columns from different tables on the same Form.

Instead, I would recommend having a simple Form where the Name and Password are entered (like most login forms do), tap Save/Submit and then the app either:

  • Accepts the login info and goes to another Form showing the details you want them to see
  • Rejects the login credentials.  Here you could use validation to present a message that the credentials are invalid (again like most login Forms would do) or navigate the user to some other view/form.

@marsbar wrote:

I tried using AND(PW[Name] = USER, PW[Password] = 1234) in the SHOW_IF Formula on a test column on "Data" and it threw back a "Cannot compare List with Text in (PW[Name] = "USER")" error. The column was actually set as TEXT. Any ideas please??


As I tried to explain before, the expression is incorrect.  The part. PW[NAME], returns a  list of names from the "PW" table.  Likewise for PW[Password].  That is not what you want.  

Maybe he can try to use Contains()..

AND(contains(PW[Name] ,[user]), contains(PW[Password],[Password]))

It will be faster to compute it for the app and it will compare a list with a single text.

 

Iโ€™ll give this a try. Thanks very much for this 


@Ceke wrote:

AND(contains(PW[Name] ,[user])), contains(PW[Password],[Password]))

It will be faster to compute it for the app and it will compare a list with a single text.


Sorry!  This will not get you an accurate match.   The matching user could be from any row and the matching password could be from any other row.  Additionally, you could be matching to a partial  user or partial password.  For example if the user was "USER1" and another user was "USER123", both of these would match in the CONTAINs() function for "USER1"

Lastly, for login to be valid the match for user and password must be from the same row in the "PW" table.


Thank again for this, really appreciate the reply. 

So if I had the name and password fields on the form, where would I add the formula to accept them and then also how would I trigger the next form to view. Sorry, I am maybe over complicating it but this for some reason Iโ€™m struggling to get my head around. Iโ€™ve looked for a template to play with on this to help understand and canโ€™t find anything similar.

As a side note if this worked I take it I could repeat the process to have different forms show depending on the login/pword?

thanks again!

Let us understand more about it, you have 1 form with user and pass right.. if they are right what should happen? It opens a table or..


@marsbar wrote:

As a side note if this worked I take it I could repeat the process to have different forms show depending on the login/pword?


Yes.

To explain how to navigate a bit further.  

Let's say you have  login Form with only the "Name" field and the "Password" field.  When these are entered, you want to choose a Form to go to next.  You would do these things:

  1. Create an action that will decide which Form to go to (example below)
  2. Attach this new action to the Form Saved behavior on your login in Form (see image below)

After creating an attaching the image, your login Form will be able to transition to the next view.  I recommend starting with just a single simple view first to understand how it works.  Also, please read the article to get more details and options - see links below.

Creating the Navigation Action

Below is a generic example of what this action might look like,  it uses the IFS() function to choose which LINKTOFORM() function to go to.  

Example Action

Set "Do This" just as shown.  The rest is tailored to your app

Screenshot 2022-11-11 at 6.44.13 PM.png

Full example expression

In the expression below, I refer to <<criteria1>>, etc.  These would be the criteria you implement to decide which Form to navigate to.  The rest are made up parameter names which, again, you would tailor to your app.  NOTE: there are other navigation functions you can use check the article for those other functions.

Screenshot 2022-11-11 at 6.56.17 PM.png

Attaching action to Form Saved Behavior

The image below show where you would attach your navigation action

Screenshot 2022-11-11 at 7.12.16 PM.png

Ok, I'm definitely getting closer I think, thanks so much for your help so far.

So I have renamed two data tables "Him" and "Her", excel data below, and filled in a row on each that I'd like the login page to go to and show (Almost like an HR page):

Him DataHim DataHer DataHer Data

I Also have the PW Table that has [ID],[Name],[Password] columns.

I have linked the action as you described to the "PW" table... hoping that if you enter "Him" as [Name] and "Him123" as [Password] this takes you to the Him form, alternatively if you enter "Her" as [Name] and "Her123" as [Password] this takes you to the Her form:

IFS (
AND([NAME]=Him,[Password]=Him123),LINKTOFORM("Him","Name", [_THISROW]),
AND([NAME]=Her,[Password]=Her123),LINKTOFORM("Her","Name", [_THISROW]),
)

... This does seem to work but I was hoping this would show the filled in data form... instead it shows this view:

Screenshot 2022-11-12 at 17.27.56.png

Is there a way to show this as a table view?? Or am I simply not grasping the process (very probably!!) - the aim is to basically show pre input data to certain users when they input their unique Name and PW, this seemingly lets certain people just use the data input form.

On a plus side, the form does input data into the excel table so that side is working!!

Thanks again and please let me know your thoughts... massive learning curve but it is making more sense every time I try things!

The examples in the expression I gave were all for opening a Form for a NEW row.   I did mention...


@WillowMobileSys wrote:

NOTE: there are other navigation functions you can use check the article for those other functions.


You can navigate to basically any view and showing any data you wish.

LINKTOFORM()

At the bottom of the above article are all of the other navigation functions available.  Check them out.

Great stuff!!! Many thanks for this, really helped me with this task and also understanding of the actions!!!

Top Labels in this Space