Hi all, I have a table (excel sheet containing a pivot table) where new entries are created automatically whenever a student abandons the course.
I would like to create a way via appsheet to add a justification for these abandonments, saved in a different table.
Hence, read from one table and create records in another table using info from the first table and newly added info.
How can I create that?
Thanks!
Solved! Go to Solution.
The problem appears to be that the Contacto, Last_Courses, and Last_Payment columns have Editable? set to OFF.
If Editable? is set to OFF, a column value cannot change under any circumstances. In effect, Editable? set to OFF means read-only.
If you just want to prevent the app user from modifying a column value, but want the app itself to modify the value (as appears to be your case), instead set Editable? to the expression, FALSE
.
Do you want the justification rows added automatically, without user involvement, or will a user be a part of the process?
With user involvement.
The user selects the record from the Abandonment table and adds the justification. The appsheet insert a new record in another table (Justifications) with the info of the student, course, month and the justification.
Create a new action for the Abandonment table called (e.g.) Justify.
Set For a record of this table, choose Abandonment.
Set Do this to App: go to another view within this app.
Set Target to the expression:
LINKTOFORM(
"Justifications_Form",
"Abandonment",
[_THISROW],
"Student",
[Student],
"Course",
[Course],
"Month",
[Month]
)
Replace Justifications_Form with the name of the form view you want used if you dont want to use the system provided form view for the Justifications table.
"Abandonment", [_THISROW]
sets the value of the Abandonment column of the new Justifications row to a Ref to the Abandonment row that spawned the justification ([_THISROW]
). Omit these if you donโt have an Abandonment column in the Justifications table.
"Student", [Student]
pre-fills the Student column of the new Justifiations row with the value of the Student column of the Abandonment row ([Student]
). Course and Month are pre-filled similarly.
Create a new deck, gallery, or table view for the Abandonment table called (e.g.) JustifyAbandonment.
Set the Row Selected event action for the view to the Justify action created above.
Display the new JustifyAbandonment view to the app user to allow them to justify an abandonment by tapping on an abandonment entry.
Hi @Steve, thanks for the great answer!
I tried repeatedly your code and I could not get it to populate the fields (fields would be empty).
Here is my code that would not work:
LINKTOFORM(
โJusticacoes_Formโ,
โAbandonosโ,
[_THISROW],
โContactIDโ,
[_THISROW].[ContactID],
โContactoโ,
[_THISROW].[Contacto],
โLast_Coursesโ,
[_THISROW].[Last_All],
โLast_Paymentโ,
[_THISROW].[Last_Payment]
)
However, when I removed the 3rd and 4th lines ( โAbandonosโ, [_THISROW], ) and all the references to [_THISROW], it seemed to work, It populated the fields of the form!!
Here is the code:
LINKTOFORM(
โJusticacoes_Formโ,
โContactIDโ,
[ContactID],
โContactoโ,
[Contacto],
โLast_Coursesโ,
[Last_All],
โLast_Paymentโ,
[Last_Payment]
)
However, though the form seemed populated ok, after completing and saving the form, the record created in the google sheet would not have the values I populated trough the code! (this fields appear empty, though the rest of the fields the user filled-in manually in the form are saved ok!)
Help! Any ideas?
What did I do wrong?
Yep, the [_THISROW].
prefixes were my mistake. Iโve updated my instructions to reflect this.
I donโt know why the 3rd and 4th lines wouldnโt work, assuming you have an Abandonment columnโฆ
Could you post a screenshot of the emulator in the app editor showing the fields populated correctly?
Hi @Steve! Your replies are so educating!
You said " assuming you have an Abandonment columnโฆ"
Quick question about the 3rd and 4th lines ( โAbandonosโ, [_THISROW], ๐
ยปยปยป a) Is Abandonos a table or a column?
In my case Abandonos (or Abandonment as in the example) is a table.
Screenshot:
Current code:
LINKTOFORM(
โJusticacoes_Formโ,
โContactIDโ,
[ContactID],
โContactoโ,
[Contacto],
โDid_Not_Payโ,
[Did_Not_Pay],
โLast_Coursesโ,
[Last_All],
โLast_Paymentโ,
[Last_Payment]
)
The record created in the google sheet is the following:
Helpโฆ
Please post a screenshot of the column list for the table from the Data > Columns tab in the app editor.
Abandonos - 1/2
Abandonos 2/2
Computed key: CONCATENATE([ContactID],": ",[Did_Not_Pay])
Justificacoes
Computed key: CONCATENATE([ContactID],": ",[Did_Not_Pay])
Side note: I tried to make ContactID and Did_Not_Pay as Not Editable but I have not managed to โconvinceโ appsheet to itโฆ
The problem appears to be that the Contacto, Last_Courses, and Last_Payment columns have Editable? set to OFF.
If Editable? is set to OFF, a column value cannot change under any circumstances. In effect, Editable? set to OFF means read-only.
If you just want to prevent the app user from modifying a column value, but want the app itself to modify the value (as appears to be your case), instead set Editable? to the expression, FALSE
.
The ContactID and Did_Not_Pay columns have a similar problem: they are effectively read-only (equivalent to Editable? set to OFF) because they are used to compute the rowโs key value.
A rowโs key cannot change once initially set; consequently, any column used to construct the key value also cannot change once initially set.
You will need to find or construct a different row key if you want to modify the ContactID and Did_Not_Pay column values.
Great and Wise @Steve! Fantastic support!
I learned so much from you reply! :
The FALSE option is quite hidden and very important!
I have more doubts but I believe I should post these in a separate thread.
Thanks!
User | Count |
---|---|
19 | |
10 | |
7 | |
5 | |
5 |