Dynamically adding fields to a form

I’m looking to create an inspection form which shows questions based on certain criteria.

The inspection starts with some general questions, then follows with questions based on another table (Questions_table) and finishes with some more general questions.

The questions to be shown are entries of the table Questions_table so the user can add questions if needed by adding a line in this table. The questions to be shown are based on a value within the first few general questions.

The answers to the questions should be recorded in another table (Answers_table) which simply records the inspectionID, Question and the answer given and possibly a picture and comment.

What would be the best way to implement this? I do not want a table with a few hundred columns with questions and answers which are shown by a certain condition. This way I won’t be able to add questions later.

Thanks in advance

So the real problem here is presenting questions and collecting answers in a collective way, on a form that consists of more than just one column corresponding to a single question and its answer. Yes?

Hi Steve,

Yes, that is correct. I need to add multiple questions from a table which I will filter. Each question has 3 answer fields (answer, comment, picture) which I want to write to another table.

I think we can solve this with Appsheet API.

From what I understand from this page:


Is that I can only add/delete/find/update records or invoke an action by using the API.
This might solve writing my answers to the answers table but I won’t be able to get the form to work as I want to. Or are there more options with the API?

See the article here.

On the very end of the sections, you will find : -

Manually Creating a JSON Body Template File with <> and <> Tags

You can get the set of rows and data from one independent table then add to another table (which is child table )

1 Like

I generated a quick and simple sample app.

When we generate new inspection, then API would run and add a set of child table.

You can access to it and it is okey you add a new inspection to see how it works.

1 Like

Whew, this is a tough one!

A form includes only those columns in the one row being viewed. That row exists entirely within a single table. You can’t join rows (or columns of rows) from multiple tables. It’s also difficult and inefficient to create forms with a variable number of fields and fields that drawn from other sources.

As I’ve thought this through, I can’t come up with a good idea that would allow you to present the entire inspection survey in a single form. It might be possible, but it would be horribly complex and delicate. I can’t imagine a single-form solution that I could recommend.

Instead, I would encourage you to reconsider a multi-form approach. A multi-form approach would also be much friendlier to users that might need to jump around the survey, or to revise previously-completed questions.

3 Likes

Thanks Tsuji,

Is it possible I can get a copy of the app to see what’s happening in the background?

Best regards,

Mitchel

Hi Steve,

Thanks for your thoughts on this one. Multi-form won’t be an option as there are about 100 questions for each criteria. For an inspector to have an additional 2 or more clicks for each question would be a lot.

How are your thoughts about the possible solution offered by Tsuji_Koichi?

Best regards,

Mitchel

@tsuji_koichi’s solution is multi-form, as far as I can see: each question has it’s own form. It’s also not clear to me why the API is involved.

For my idea, there’s no requirement that two or more clicks be needed to advance between questions. It’s easy enough to advance to the next question automatically upon saving a form.

I am also working on nearly this exact same thing. Though I don’t know how appsheet will respond to having so many columns in one table, I’ve begun my inspection form using only SHOW_IF and REQUIRED constraints.

There is an initial list of “systems” from which the user must choose. Based on the choice of the system, the SHOW_IF will allow the user to see the questions.

Hi Mitchel,

I m afraid i m not perfectly understand your requirement, but I think I still believe API would solve your case. For instance, we put a couple of fields in the main inspection form, then it would dynamically change the set of rows which would be picked up from source table, then add set of rows, again dynamically to the child table (inspection check list) .

How would you setup this multi-form in a dynamic way so you can add questions easily? I understand how to add a new row in the answers table by adding a reverse ref in the Inspection form. But I’m unsure how to add all the questions (inspection items) the inspector has to check.

Where can I find more information about setting up multi-forms?

Hi Mitchel,
If you are fine with having multiple table for the different set of the questionnaire forms, then there should be some solutions.

Firstly app using API post request.

Then another solutions is using multiple actions WIHTOUT using api call.

Please have a look to see how app works. Hope this will give you a clue to solve your problems.

2 Likes

I couldn’t get it to work the way I wanted and decided to go for a solution with many columns. I hope future updates in Appsheet will make this easier to implement.

Thanks all for your input and thoughts!

You are welcome.

Did you make a this work in the End. Have the same challenge.