2 Replies Latest reply on Apr 29, 2014 9:31 AM by no_name_123

    How can i make it work around if a column is NULL?

    no_name_123

      I have a table that display some question,

      But some may have 4 or 5 question.

      Here is my code.

                <cfloop index="i" from="1" to="5">
                       <cfset question = GetEmployeeCSEDepts["csedept_question" & i][GetEmployeeCSEDepts.CurrentRow]>
                             <tr>
                                 <td valign="top">
                                        <select name="sltRating#i#" size="1">
                                               <option value="">-- Select Rating --</option>
                                                <option value="5">Exceptional</option>
                                                  <option value="4">Exceeds Standards</option>
                                                   <option value="3">Successful</option>
                                                   <option value="2">Needs Improvement</option>
                                                   <option value="1">Unsatisfactory</option>
                                                   <option value="0">N/A</option>
                                           </select>
                                        </td>
                               <td valign="top">#question#</td>
                                    </tr>
                      </cfloop>
      

      So rigth now it display all the quesions but it even questio5 is null.

      How will I be able to make it work around to display if csedept_question is NULL to not show

      to the user?

        • 1. Re: How can i make it work around if a column is NULL?
          EddieLotter Level 3

          If I understand you correctly, this should work:

                    <cfloop index="i" from="1" to="5">
                           <cfset question = GetEmployeeCSEDepts[
          "csedept_question" & i][GetEmployeeCSEDepts.CurrentRow]>

                             <cfif question neq "">
                                 <tr>
                                     <td valign=
          "top">
                                            <select name=
          "sltRating#i#" size="1">
                                                   <option value=
          "">-- Select Rating --</option>
                                                    <option value=
          "5">Exceptional</option>
                                                      <option value=
          "4">Exceeds Standards</option>
                                                       <option value=
          "3">Successful</option>
                                                       <option value=
          "2">Needs Improvement</option>
                                                       <option value=
          "1">Unsatisfactory</option>
                                                       <option value=
          "0">N/A</option>
                                               </select>
                                            </td>
                                   <td valign=
          "top">#question#</td>

                               </tr>

                            </cfif>

                          </cfloop>

          • 2. Re: How can i make it work around if a column is NULL?
            no_name_123 Level 1

            opps my bad it did work , ignore reply .

            thanks