1
0
-1

Here I have attached my sample application for reference. On clicking rapid assessment in the user view , I want this form to show data from different database tables, so I have used custom html. Is there any other way to do this?

And for drop down I have used select box and have binded it using JDBC binder so that it will reflect values  from different database table. After submitting this form, the corresponding database table is storing my name instead of storing the selected values of drop down list. Also not storing the values(all questions) shown using custom HTML. Can someone advise the best way to do this?

I want this form to store all the required values in the corresponding database table and after submitting it in the userview I want the form to displays the next question from main_ques table along with questions from sub_ques table & the drop down. I have put all the questions in different table or form so that in future it can be change if needed. If I used form for each question it will be difficult to make changes in each form  if needed later.

Can someone help please?

APP_SAMPLE.jwa

    CommentAdd your comment...

    2 answers

    1.  
      1
      0
      -1

      Hi Reid Hershel ,

      Thank you so much for the minimal app you have created, it helps me a lot. (smile)

      Regards,

      Manjeet

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi Manjeet,

        When i submit the form with custom html used. I'm hitting the following error

        ERROR 30 Apr 2021 22:05:35 org.joget.apps.form.lib.BeanShellFormBinder  - Error executing script
        Sourced file: inline evaluation of: ``import java.text.DecimalFormat;  import org.joget.apps.app.service.AppUtil;  imp . . . '' : Undefined argument: id  : at Line: 32 : in file: inline evaluation of: ``import java.text.DecimalFormat;  import org.joget.apps.app.service.AppUtil;  imp . . . '' : ( element , newRows , formData , id ) 
        
        Called from method: store : at Line: 55 : in file: inline evaluation of: ``import java.text.DecimalFormat;  import org.joget.apps.app.service.AppUtil;  imp . . . '' : store ( element , rows , formData ) 
        	at bsh.BSHArguments.getArguments(Unknown Source)
        	at bsh.BSHMethodInvocation.eval(Unknown Source)
        	at bsh.BSHPrimaryExpression.eval(Unknown Source)
        	at bsh.BSHPrimaryExpression.eval(Unknown Source)
        	at bsh.BSHBlock.evalBlock(Unknown Source)
        	at bsh.BSHBlock.eval(Unknown Source)
        	at bsh.BshMethod.invokeImpl(Unknown Source)
        	at bsh.BshMethod.invoke(Unknown Source)
        	at bsh.BshMethod.invoke(Unknown Source)
        	at bsh.Name.invokeLocalMethod(Unknown Source)
        	at bsh.Name.invokeMethod(Unknown Source)
        	at bsh.BSHMethodInvocation.eval(Unknown Source)
        	at bsh.BSHPrimaryExpression.eval(Unknown Source)
        	at bsh.BSHPrimaryExpression.eval(Unknown Source)
        	at bsh.BSHReturnStatement.eval(Unknown Source)
        	at bsh.Interpreter.eval(Unknown Source)
        	at bsh.Interpreter.eval(Unknown Source)
        	at bsh.Interpreter.eval(Unknown Source)
        	at org.joget.apps.form.lib.BeanShellFormBinder.executeScript_aroundBody20(BeanShellFormBinder.java:84)
        	at org.joget.apps.form.lib.BeanShellFormBinder.executeScript_aroundBody21$advice(BeanShellFormBinder.java:99)
        	at org.joget.apps.form.lib.BeanShellFormBinder.executeScript(BeanShellFormBinder.java:1)
        	at org.joget.apps.form.lib.BeanShellFormBinder.store_aroundBody12(BeanShellFormBinder.java:57)
        	at org.joget.apps.form.lib.BeanShellFormBinder.store_aroundBody13$advice(BeanShellFormBinder.java:99)
        	at org.joget.apps.form.lib.BeanShellFormBinder.store(BeanShellFormBinder.java:1)
        
        

        Basically, the variable "id" is not defined. I went to uncomment this line at line 40.

            String formId = "user"; // the table of database is configured in the form with id "user"
        
        

        Submitting the form again, I'm hitting new error.

        ERROR 30 Apr 2021 22:10:54 org.joget.apps.form.lib.BeanShellFormBinder  - Error executing script
        Sourced file: inline evaluation of: ``import java.text.DecimalFormat;  import org.joget.apps.app.service.AppUtil;  imp . . . '' : Typed variable declaration : Class: AppService not found in namespace : at Line: 37 : in file: inline evaluation of: ``import java.text.DecimalFormat;  import org.joget.apps.app.service.AppUtil;  imp . . . '' : AppService 
        
        Called from method: storeToOtherFormDataTable : at Line: 32 : in file: inline evaluation of: ``import java.text.DecimalFormat;  import org.joget.apps.app.service.AppUtil;  imp . . . '' : storeToOtherFormDataTable ( element , newRows , formData , id ) 
        Called from method: store : at Line: 55 : in file: inline evaluation of: ``import java.text.DecimalFormat;  import org.joget.apps.app.service.AppUtil;  imp . . . '' : store ( element , rows , formData ) 
        	at bsh.BSHAmbiguousName.toClass(Unknown Source)

        I'm not sure what your logic of storing data is.

        But in terms of form design, I would imagine that, in the assessment form, you will be asking a lot of questions. 

        It does not look to the scablale to me.

        You can try to explore the use of form grid or other multi-row capable form elements. You can also check out subform repeater https://marketplace.joget.org/jw/web/userview/mp/mpp/_/vad?id=Subform_Repeater.

        I will post here again when I can find a sample app that is similar to such requirements that make use of subform repeater for your reference.

        Thanks.

        Hugo

        1. Manjeet

          Hi

          Hugo

          I don't know why you are getting errors while running this app.  Also, form grid and other multi-row capable form elements are to write to multiple tables but my concern is to read from other forms. I am attaching a diagram for you to understand the logic I want to built. Please have a look at the diagram and I will look forward for your advice to achieve this logic.


        2. Hugo

          Hi Manjeet,

          Please allow me to clarify. Am I right to say:-

          1. Table1 holds 10 records. Each record here may have multiple children in table2.
          2. Table2 records belongs to table1. Each record has only one parent.
          3. Table3 holds the selections. Every question in table2 has fixed selection of answers.

          I would imagine that it would be possible to design this in subform repeater. The challenge of using subform repeater is that, it will show ALL questions in one go, without the navigation. If navigation and displaying everything in one go is OK for you, please try out subform repeater.

          Let's say we are able to design the form such that with navigation, in your requirements, do you allow the user to navigate to previous? back and forth freely?

          Cheers

        3. Manjeet

          Hi Hugo,

          1. Table1 holds 10 records. 
          2. Table2 holds 3 records only.
          3. Table3 holds 4 records only.

          In Form 4 (as shown in the diagram), I want to show 1st record from table1. Also, all three records of table2 and along with these three records, I want to show all records of table3 as a dropdown. After submission the form will display the second record from table1 along with all records from table2 and table3 records as a drop down selection. 

          If I use sub form repeater, It will allow to store data in table 1, 2 and table 3, but, I want the form to get data from table1, table 2 and table 3 and store the user selection(drop-down) in a different table with all the four questions of the form.

          Yes, I want user to navigate back and forth freely.

          I hope this explanation clarifies.

        4. Reid Hershel

          Hi Manjeet,

          Using subform repeater in form 4 will not store data in table 1,2 and 3, it will instead get the data from those tables instead by configuring the load binder.

          Attached below is a minimal app that I think might help you. However, it does not comes with the ability to navigate back and forth. Perhaps you could look into Section Wizard & Section Tab for navigation.Section Wizard & Section Tab

          This is the app that is using subform repeater.
          subformRepeater.jwa

        CommentAdd your comment...