===== Steps to Fill in the Questionnaire Details Table (Complete Guide) ===== The **Questionnaire Details Table (`fw_questionnairedetails`)** is where you define each question that appears in a survey, including its order, type, and visibility.\\ This section provides a **practical summary** on how to fill in the table for each question.\\ For a complete description of the table structure and field explanations, please refer to the → [[questionnairedetails|Questionnaire Details Table]]. ==== 1. Add the ID (id) ==== This is the **primary key** (auto-incremented) for the table.\\ **Do not manually enter** this value if inserting data directly via the database.\\ It is automatically generated. ==== 2. Add the Module ID (qid) ==== **qid** refers to the **Module ID** (from the **fw_modules** table) to which the question belongs.\\ This is a **foreign key** that links the question to the respective survey/module.\\ **Example:**\\ If your module ID is **5** for **Customer Satisfaction Survey**, enter: qid = 5 ==== 3. Set the Branch ID (branchid) ==== **branchid** defines the **branch visibility** of the question.\\ If **branchid = 0**, the question will appear in **all branches**.\\ If **branchid** refers to a particular branch in the **fw_branches** table, the question will only appear in that branch.\\ **Example:**\\ For visibility in **all branches**, set: branchid = 0 To show the question only in **Branch A (ID: 2)**: branchid = 2 ==== 4. Define Major and Minor Question ID (majorqid and minorqid) ==== - **majorqid** is the **primary question number** (like Q1, Q2, Q3).\\ - **minorqid** is used **only for Aspect questions**. For all other question types, set **minorqid = 0**.\\ **Example:**\\ For a Single Response Question (Q1): majorqid = 1 minorqid = 0 For an Aspect Question (Q2 with 3 sub-aspects): majorqid = 2, minorqid = 1 → Aspect: Price\\ majorqid = 2, minorqid = 2 → Aspect: Quality\\ majorqid = 2, minorqid = 3 → Aspect: Service\\ ==== 5. Set the Display Order (displayorder) and Page Number (surveypageno) ==== - **displayorder** defines the order in which the question will appear.\\ - **surveypageno** is the page number on which the question appears.\\ **Example:**\\ For Page 1 with 3 questions: Q1 → displayorder = 1, surveypageno = 1 Q2 → displayorder = 2, surveypageno = 1 Q3 → displayorder = 3, surveypageno = 1 ==== 6. Set Client Sheet Category Order (cscategoryord) ==== If your survey has a **Client Sheet (CS)** with specific categories, set the order in which this question should appear in the report.\\ If the question has no client sheet order, set it as: cscategoryord = 0 ==== 7. Choose the Question Type (questiontypecode) ==== Enter the code that matches your question type from the → [[Question Type Codes Table]].\\ This ensures the system processes the question correctly. ==== 8. Define Dual Aspects (dualaspects) ==== If you want the **same aspect** to appear on both sides of a question (like Agree ↔ Disagree): dualaspects = 1 Otherwise, set: dualaspects = 0 ==== 9. Set Start and End Dates (startdate and enddate) ==== If the question should appear only during a specific time frame, you can set: - **startdate** → When the question becomes visible. - **enddate** → When the question should disappear. **Example:**\\ Active from **March 1, 2025 to March 30, 2025**: startdate = 2025-03-01 enddate = 2025-03-30 ==== 10. Set Display Conditions (displaycondition, displayparams) ==== - **displaycondition** is the logic that decides whether a question should appear based on previous answers.\\ - **displayparams** is the condition value associated with the logic.\\ **Example:**\\ If Question 2 should appear only if Q1 = Yes: displaycondition = 1 displayparams = "Q1=Yes" ==== 11. Set Mandatory Status (mandatory) ==== If answering the question is **mandatory**, set: mandatory = 1 If it's optional, set: mandatory = 0 ==== 12. Import Data Mandatory (importdatamandatory) ==== If this question is **mandatory when importing data**, set: importdatamandatory = 1 Otherwise: importdatamandatory = 0 ==== 13. Hide Back Button (hidebackbtn) ==== If you want to **prevent users from going back** to a previous question after answering: hidebackbtn = 1 Otherwise: hidebackbtn = 0 ==== 14. Set Spectrum View (spectrumview) ==== This only applies to Slider or Aspect questions. Choose the display format: - horizontal - vertical ==== 15. Set Minimum/Maximum Options (minansopt, maxansopt) ==== If you want to limit the minimum or maximum number of answers a respondent can choose: **Example:**\\ Allow at least **2 options** but no more than **5**: minansopt = 2 maxansopt = 5 ==== 16. Set Status (status) ==== Controls the **status** of the question: **1** = Active **0** = Inactive **2** = Archived ==== 17. Set Ghost Question (ghostquestion) ==== If the question is a **hidden backend question** (like calculated scores), set: ghostquestion = 1 Otherwise: ghostquestion = 0 ==== 18. Set Star Rating (enablestarrating) ==== If this is a **Star Rating** question, set: enablestarrating = 1 Otherwise: enablestarrating = 0 ==== 19. Save and Reload Survey (saveandreloadsurvey) ==== If answering this question should **reload the page** (useful for filtering answers), set: saveandreloadsurvey = 1 ==== 20. Handle Dependent Questions (dependentqtns) ==== If this question has **dependent questions** (questions that only appear based on previous answers): dependentqtns = 1 ==== 21. Invisible Question (invisiblequestion) ==== If the question should appear in **reports** but not in the survey: invisiblequestion = 1 ==== ✅ Notes ==== - Always ensure the **qid** is linked to an active module from → [[fw_modules]].\\ - Use valid **question type codes** \\ - For **Aspect Questions**, always set minorqid appropriately.\\ - If the question should only appear under certain conditions, use **displaycondition** and **displayparams**.\\ - Use **cscategoryord** only if the question needs a place in the **Client Sheet**.\\ - **Ghost Questions** are only used for internal calculations or backend logic — they never appear in the survey.\\ **💡 Best Practice:**\\ - Always fill **startdate** and **enddate** if the question has a time-limited window.\\ - For dependent questions, always test the **display conditions** before finalizing.\\ - Avoid setting **hidebackbtn** unless absolutely necessary.\\