Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

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

New Here ,
Apr 29, 2014 Apr 29, 2014

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?

351
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Apr 29, 2014 Apr 29, 2014

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>
                            

...
Translate
Advocate ,
Apr 29, 2014 Apr 29, 2014

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>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 29, 2014 Apr 29, 2014
LATEST

opps my bad it did work , ignore reply .

thanks

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources