Show "Add" if ID is not already in table

I have two tables linked together by unique ID numbers in an ID column in both tables. One is a top level "Employees" table and the other is a table acting as a database for various dates stored in one row for each linked ID called "Updates." I do not want to show the "Add" option in the automatically generated inline ref view at the bottom of the EEs_Detail view if the ID already exists in the 'Updates' table. In this case, ideally, all that would show is an edit action in place of the system generated View and Add actions.

I've tried several different expressions to try and make this happen and I am coming up short. I have a feeling its because the data I am searching for, the ID, is a Ref type. Any help with the proper expression is much appreciated!!!

Thanks in advance,

Daryl

Solved Solved
0 12 527
1 ACCEPTED SOLUTION

Use the [Related...] VC in your COUNT(). 

View solution in original post

12 REPLIES 12

I'm not sure that will work for me. What I am trying to avoid is that "Add" at the bottom of this image as I only want one row per ID in this table.

 Screenshot 2022-05-11 133410.jpg

If I could figure out how to have it show ONLY when there are no Ref records associated to that ID, that would be ideal. Being that it tells you how many related records there are, it would seem this would be possible.

This is how I accomplished this:

ADD is gone.PNG

As you can see the "parts used on this work order" does not have the add button. The reason I wanted this was because the Parts that are used are added in a different view of the app however I still wanted to be able to see the parts used. I can edit the one part but I cannot add more. 

There are other posts in regards to this in the community however I don't believe there are any that ALLOW ONLY A CERTAIN AMOUT OF ADDS to a table. 

I am not aware of a way to only allow one record to be added and then the add button removed. So unfortunately this post may be ignored by others because I replied to it. So you may want to ask again. If you find a way to do it please keep me updated because I have situations in my app where I would like ONLY ONE record to be added and then the add go away. I know that you could create conditions on your form that read  information and then would prompt the user that they cannot add another record..

Search the community maybe there is new information in regards to this but rest assured it is not an easy thing to do. 

Thanks, 

Josh 

  1. Hide the system-generated Add action for the child table.
  2. Add your own action to create new child records with LINKTOFORM.
  3. This action would sit on your parent table and show at the top of the same detail view.
  4. Set the action's condition with COUNT( [Related children] )

https://help.appsheet.com/en/articles/2357261-linktoform

https://help.appsheet.com/en/articles/2347641-count

 

If I remember correctly it is impossible to change this action to something you would like? It is either the system generated add action for the child table or nothing.

add is there.PNG

@Josh_Klassen , that is correct.

Thank you for your reply!!!

When I do step 4 in your instructions, I get this:

Screenshot 2022-05-12 113622.jpg

To be clear, "Related Updates 1" is the system generated verbiage above the child table view stating that the child table, "Updates", has 1 related record. What would you suggest here and thank you?!

Use the [Related...] VC in your COUNT(). 

Ok... got it to work with this expression: COUNT([Related Updates])=0

I had no idea there was actually a column called "Related Updates" in my parent EEs table.

Now I just need to figure out why when I input a date into one column in the Child table (Updates) its putting it into all date columns.

Again, thank you so much!!!

@Marc_Dillon In your 4-step approach, you suggest to use a custom action on the Parent.  Do you know why we can't hide the Child Add button?  Do you think its a bug?

Theoretically,  we should be able to apply to the Behavior of the Child Add button an expression like:

 COUNT([Parent].[Related children]) = 0

Or even

COUNT(SELECT(Children[ID], [Parent] = [_THISROW].[Parent])) = 0

But neither of these work. 

Marc_Dillon_0-1652385000046.png

.


@Marc_Dillon wrote:

Marc_Dillon_0-1652385000046.png


Yes, of course!!  That explains it.  No access to any row information.  Ummm, I knew that!  Was just testing you!  (yeah right!) ๐Ÿ™‚ 

Top Labels in this Space