Hi! I'm an Appsheet newbie.
I'm creating an app that have a table with 2 slices separated by a special flag which connected with 2 different views.
Now I want that from view A, when user click Add button, it will open Register screen that allow user register inputted data into DB with flag = 1 (that sorted in to slice of view A), and from view B, when user click Add button, it will open Register screen that allow user register inputted data into DB with flag = 2 (that sorted in to slice of view B).
Is there a way to do it?
As the data content is same, just using different flag, I really don't want to manage that data as a new table with the same content.
Furthermore, for the table, slices and views above, I want a special column with labelled as A at view A but then labelled as B in view B (column content is the same).
Please give me some advices. Thanks so much!
Solved! Go to Solution.
You can do this with your own "Add" action where it selects the Flag depending on the view name. It would be something like..
IF(CONTEXT("View")="ViewA",
LINKTOFORM("SliceA_Form","Flag","1"),
LINKTOFORM("SliceB_Form","Flag","2")
)
It should work , if the expression is coded correctly in all respects , view names etc. Hope you are trying it in the "display name" property of the column settings. Following is an example that changes the column display name based on view in my case.
Edit: I guess you are probably using display names of views also in the expression. If so, that is incorrect. In the expression, original names of the views need to be used.
So V1_Form to be used in the expression and not "Input X", V1_Detail and not "Confirm X" and so on.
App results below
Left -summary view, right" detail view
Form view
@Evendo wrote:
Furthermore, for the table, slices and views above, I want a special column with labelled as A at view A but then labelled as B in view B (column content is the same).
For this you could use display name property of the column setting along with CONTEXT() functions.
SWITCH(CONTEXT("View")= "View A", "Column A", "View B", "Column B", "Column A")
Configure column properties - AppSheet Help
@Evendo wrote:
Now I want that from view A, when user click Add button, it will open Register screen that allow user register inputted data into DB with flag = 1 (that sorted in to slice of view A), and from view B, when user click Add button, it will open Register screen that allow user register inputted data into DB with flag = 2 (that sorted in to slice of view B).
Typically for each summary view based on a slice, a corresponding system generated view is created for slice for form and detail views. So if you have two summary views "View A" for slice A and "View B" for Slice B, then there should be system generated form views as well. "View A_Form" and "View B_Form" . When the user tries to add record from "View A" , the form view "View A_Form" opens and when the user adds record from "View B"
Here also, you could try the initial value expression for the flag column, something like
IF(CONTEXT("View")="View A_Form", 1 , 2)
@Suvrutt_Gurjar wrote:
For this you could use display name property of the column setting along with CONTEXT() functions.
SWITCH(CONTEXT("View")= "View A", "Column A", "View B", "Column B", "Column A")
I tried to use SWITCH and CONTEXT but as the display name still isn't what I want to display, please let me confirm it again here
I have 1 table name A, from this table I create 2 different slice A1 and A2. I created 2 view V1 and V2 connected to data of A1 and A2 respectively. Then, as the system auto-generated views V1_Form, V1_Detail, V2_Form, V2_Detail, I named (via "Display name" field) V1_Form as "Input X", V1_Detail as "Confirm X", V2_Form as "Input Y", V2_Detail as "Confirm Y".
Now, if I want to display column Name as "Name X" when displaying that column at forms V1, V1_Form, V1_Detail, and as "Name Y" when displaying that column at forms V2, V2_Form, V2_Detail, is correct to use the below syntax when setting the column's display name?
SWITCH(CONTEXT("View")="V1", "V1", "Name X", "V1_Form", "Name X", "V1_Detail", "Name X", "V2", "Name Y", "V2_Form", "Name Y", "V2_Detail", "Name Y", "Name X")
You can do this with your own "Add" action where it selects the Flag depending on the view name. It would be something like..
IF(CONTEXT("View")="ViewA",
LINKTOFORM("SliceA_Form","Flag","1"),
LINKTOFORM("SliceB_Form","Flag","2")
)
Now I can separate the data registered by each slide. Thanks for your advice.
@Evendo wrote:
SWITCH(CONTEXT("View"), "V1", "Name X", "V1_Form", "Name X", "V1_Detail", "Name X", "V2", "Name Y", "V2_Form", "Name Y", "V2_Detail", "Name Y")
This expression is partially correct because, SWITCH() needs a default value in case any of the explicit options are false, so you could modify the expression something like
SWITCH(CONTEXT("View"), "V1", "Name X", "V1_Form", "Name X", "V1_Detail", "Name X", "V2", "Name Y", "V2_Form", "Name Y", "V2_Detail", "Name Y" , " Default Name")
@Suvrutt_Gurjar wrote:SWITCH(CONTEXT("View"), "V1", "Name X", "V1_Form", "Name X", "V1_Detail", "Name X", "V2", "Name Y", "V2_Form", "Name Y", "V2_Detail", "Name Y" , " Default Name")
Thank you. I tried it, but the "Default Name" was displayed in all listed forms/views. Really wonder what is the problem here
It should work , if the expression is coded correctly in all respects , view names etc. Hope you are trying it in the "display name" property of the column settings. Following is an example that changes the column display name based on view in my case.
Edit: I guess you are probably using display names of views also in the expression. If so, that is incorrect. In the expression, original names of the views need to be used.
So V1_Form to be used in the expression and not "Input X", V1_Detail and not "Confirm X" and so on.
App results below
Left -summary view, right" detail view
Form view
I recognized that it was my problem with view name. Now I can display item's name in each view in the way I want. Thanks so much for your kindly support!
User | Count |
---|---|
17 | |
11 | |
7 | |
4 | |
3 |