Solved

CF - Display data based on field value

Posted on 2013-01-14
52
352 Views
Last Modified: 2013-01-15
I am trying to get a value to display based on the value in another field.  For example if the supervisor ID is 21 I want the name from the #first_name# and #last_name# field to display - if the ID is 22 I want that name to display and so on.  As it is now it displays everyones name but does not reflect what the supervisor ID is.

Any help is appreciated.

<cfoutput query="getEmployees">
<cfform method="post" style="margin:0px" action="Admin.cfm">
	<cfinput type="hidden" name="ID" value="#ID#">
<tr>
<td><cfinput type="text" name="first_name" value="#first_name#" size="10"></td>
     	  <td><cfinput type="text" name="middle_name"  value="#middle_name#"   size="1"/></td>
          <td><cfinput type="text" name="last_name" value="#last_name#"   size="15"/></td>
          <td><cfinput type="text" name="main_dept"  value="#main_dept#"   size="2"/></td>
          <td><cfinput type="text" name="job_title"  value="#job_title#"   size="30"/></td>  
          <td><cfinput type="text" name="phone_ext"  value="#phone_ext#"   size="3"/></td> 
          <td><cfinput type="text" name="email_name"  value="#email_name#"   size="15"/></td> 
          <td><cfinput type="text" name="birth_month"  value="#birth_month#"   size="2"/></td> 
          <td><cfinput type="text" name="birth_date"  value="#birth_date#"   size="2"/></td> 
          <td><cfinput type="text" name="payroll_num"  value="#payroll_num#"   size="6"/></td> 
          <td>
             <select name="SuperVisorID">
             <option value="#supervisor_ID#">#last_name#,#first_name#</option>
             </select>
             </td>		
           <td>
        <cfinput type="submit" name="editing"
			value="EDIT" style="font-size:xx-small"> 
       	  </td>
           <td>
		<cfinput type="submit" name="deleting"
			value="Inactivate" style="font-size:xx-small">
		</td>
		</tr>
</cfform>
</cfoutput>

Open in new window

0
Comment
Question by:JohnMac328
  • 27
  • 13
  • 9
  • +1
52 Comments
 
LVL 28

Expert Comment

by:becraig
ID: 38775930
Question:
I am trying to get a value to display based on the value in another field.  For example if the supervisor ID is 21 I want the name from the #first_name# and #last_name# field to display - if the ID is 22 I want that name to display and so on.  As it is now it displays everyones name but does not reflect what the supervisor ID is.

Suggestion:
<cfset myval=#supervisor_ID#>

<Cfif myval = "expected value">
<cfoutput>#myval -  #first_name# and #last_name# </cfoutput>
</cfif>

Open in new window



The idea being you simply want to use an if then else statement to validate the supervisor id is what you expect and to display the data is that output row to match the supervisor id.

The above is not meant to be the final solution but to give you an idea of how to go about it.
0
 
LVL 14

Expert Comment

by:RickEpnet
ID: 38776276
Show us the query getEmployees it might be as simple as putting a Where statement in the quote for example

Where supervisor_ID = 21

if supervisor_ID is a text field

it Where supervisor_ID = '21'
0
 

Author Comment

by:JohnMac328
ID: 38776288
Actually there are several codes that have supervisor name associated -
21
263
291
30
406
418
469
47
501
58

<cfquery name="getEmployees" datasource="#datasource#">
      SELECT *
      FROM employee_dataTest
    order by Last_Name
</cfquery>
0
 
LVL 28

Expert Comment

by:becraig
ID: 38776311
If I am reading this correctly:
             <select name="SuperVisorID">
             <option value="#supervisor_ID#">#last_name#,#first_name#</option>
             </select>

That output will have values for everyone including supervisors.

You want <option value="#supervisor_ID#"> to be populated with the supervisor ID and it isn't being populated  ?
0
 

Author Comment

by:JohnMac328
ID: 38776325
It is displaying the correct supervisor ID but like you said it is just displaying the employees name and not the supervisor name.  Where we have employee Jane Doe I want the supervisor name of John Doe to display in the supervisor field - the supervisor for Jane is ID 21 for example.
0
 
LVL 14

Expert Comment

by:RickEpnet
ID: 38776344
I am lost I do not understand what you are trying to do.

This query
<cfquery name="getEmployees" datasource="#datasource#">
      SELECT *
      FROM employee_dataTest
    order by Last_Name
</cfquery>

Does it have the regular employees and the supervisors?
0
 

Author Comment

by:JohnMac328
ID: 38776351
Yes - all in one table
0
 
LVL 28

Expert Comment

by:becraig
ID: 38776372
Ok now I get you.


So since the DB has the supervisor ID does it also map the supervisor ID to the supervisor name  ?

It sounds to me as though that is all you need to do is to map the supervisor ID to the correct name or simply display the First and last name of the supervisor if there is some other field that maps...
e.g.  i am assuming the supervisors are also employees in this table, so how do you identify a supervisor in this table  ?

You code is doing what it is supposed to by displaying the employee name - you now need to nest a query to get then display the supervisor details.
0
 

Author Comment

by:JohnMac328
ID: 38776398
The supervisor ID is also the same as the employee ID  - For example employee ID 47 is also the supervisor of employee 404 - Employee ID 404's record has a supervisor ID field - the value of that field is 47

A supervisor is an employee and some are supervisors - when I tried two queries I ran into the trouble of a query within a query
0
 
LVL 28

Expert Comment

by:becraig
ID: 38776400
If you are lucky and the supervisor id is the same as the supervisor's employeeid, then you are home free.

select * from employee_dataTest where employeeid = #supervisor_ID#
0
 
LVL 28

Expert Comment

by:becraig
ID: 38776418
Try this:

<cfoutput query="getEmployees">
<cfform method="post" style="margin:0px" action="Admin.cfm">
	<cfinput type="hidden" name="ID" value="#ID#">
<tr>
<td><cfinput type="text" name="first_name" value="#first_name#" size="10"></td>
     	  <td><cfinput type="text" name="middle_name"  value="#middle_name#"   size="1"/></td>
          <td><cfinput type="text" name="last_name" value="#last_name#"   size="15"/></td>
          <td><cfinput type="text" name="main_dept"  value="#main_dept#"   size="2"/></td>
          <td><cfinput type="text" name="job_title"  value="#job_title#"   size="30"/></td>  
          <td><cfinput type="text" name="phone_ext"  value="#phone_ext#"   size="3"/></td> 
          <td><cfinput type="text" name="email_name"  value="#email_name#"   size="15"/></td> 
          <td><cfinput type="text" name="birth_month"  value="#birth_month#"   size="2"/></td> 
          <td><cfinput type="text" name="birth_date"  value="#birth_date#"   size="2"/></td> 
          <td><cfinput type="text" name="payroll_num"  value="#payroll_num#"   size="6"/></td> 
          <td>
<cfquery name="getsup" datasource="#datasource#">
      SELECT *
      FROM employee_dataTest 
	where employeeid = #supervisor_ID#
</cfquery>

       <CFLOOP QUERY="Getsup">
             <select name="SuperVisorID">
             <option value="supervisor_ID#">#Getsup.last_name#,#Getsup.first_name#</option>
             </select>
      </cfloop>  

             </td>		
           <td>
        <cfinput type="submit" name="editing"
			value="EDIT" style="font-size:xx-small"> 
       	  </td>
           <td>
		<cfinput type="submit" name="deleting"
			value="Inactivate" style="font-size:xx-small">
		</td>
		</tr>
</cfform>
</cfoutput>

Open in new window

0
 

Author Comment

by:JohnMac328
ID: 38776424
Looks like some are not the same - i guess I will have to create a supervisor table with a relationship
0
 
LVL 14

Expert Comment

by:RickEpnet
ID: 38776438
Can you not just add a field call Supervisor and either put a Y or a N in it or a 1 or a 0? A separate table I would thing would be better.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38776931
Not sure I fully understand the form, but I'm almost certain you don't need another table or column.  To provide the correct answer I need to know:

1) Does your "getEmployees" contain multiple employee records OR just one?
2) Should <select name="SuperVisorID"> contain ALL employees OR just the current supervisor?
0
 

Author Comment

by:JohnMac328
ID: 38778107
Hi agx,

getEmployees gets all the employees - <select name="SuperVisorID">  should display all the supervisors allowing one to be selected depending on who the new employee is going to be under.
0
 

Author Comment

by:JohnMac328
ID: 38778643
getEmployees brings one record for each employee - I did not read the comment right
0
 

Author Comment

by:JohnMac328
ID: 38778690
0
 

Author Comment

by:JohnMac328
ID: 38778742
Let me back up since I think this is confusing.

Employee Jane Doe with and employee ID of 10

Employee John Doe with an ID and a Supervisor ID 0f 20

Employee Jane Doe has in her record a value of 20 in her Supervisor ID field

I want the name John Doe to appear on the screen when someone is looking at her record and not the number 20
0
 
LVL 28

Expert Comment

by:becraig
ID: 38778813
Ok so what I indicated above should work easily if you can do a 1 - 1 mapping in your table for persons who are employees and are also supervisors.

You now can simply ensure:
1. A person's employee ID is the same as supervisor ID (For a supervisor that is)
2. Add a new column where if an employee is a supervisor (The ID assigned to him as a supervisor is in that column)

e.g.  John doe has emp ID 427  - He is a supervisor and his Supervisor ID is 17
The column should look like
Fname - Lname - Field1 - Field2 - EmployeeID - SupervisorID - IDassignedassupervisor ...

If you get the idea I am going with..
Once you do this your second query is easy it will simply be select * from employees where IDassignedassupervisor = #SupervisorID#

Then do as indicated in the cfloop above.
0
 

Author Comment

by:JohnMac328
ID: 38778837
The only fields are ID and supervisor_ID

John Doe ID 427 has 17 in the supervisor_ID field

I want the name of his supervisor (who is another employee)  and not the number 17 to display on the screen - It's looking like I will have to make a supervisor table with the key field to get a name to show
0
 
LVL 28

Expert Comment

by:becraig
ID: 38778848
Re-read what I wrote above, you dont need to create another table.


IF John Doe has a supervisor whose ID is 27 - What is the employee ID of that supervisor ?
0
 

Author Comment

by:JohnMac328
ID: 38778868
27 is the employee ID of the supervisor
0
 

Author Comment

by:JohnMac328
ID: 38778891
I try this

<cfquery name="getSupervisor" datasource="#datasource#">
      SELECT   *
FROM         employee_dataTest
WHERE     (leader_coach = 1) OR
                      (supervisor = 1) AND (active_account = 1) AND (ID = supervisor_ID)
</cfquery>

           <CFLOOP QUERY="getSupervisor">
             <select name="SuperVisorID">
             <option value="#supervisor_ID#">#getSupervisor.last_name#,#getSupervisor.first_name#</option>
             </select>
      </cfloop>

And I get what the image shows

screen
0
 

Author Comment

by:JohnMac328
ID: 38778895
Every supervisor shows for each employee
0
 
LVL 28

Expert Comment

by:becraig
ID: 38779000
This seems to be due to your initial query.
 (supervisor = 1) AND (active_account = 1) AND (ID = supervisor_ID)

This is what I think you are trying to get:

Select * from employee_dataTest (Which brings back all employees)

Then

The subquery would look like this:

Select * from employee_dataTest where (some value that is unique to that supervisor and is mapped to supervisor id) = supervisor_ID

The idea here is
1. Your first query outputs all the employees
2. for each employee that is listed the second query finds the person who owns that supervisor ID.

Your only problem the one we have been trying to resolve is this:
Find a way to have the supervisor's record accessible by the supervisor id that is linked to each employee beneath him.

If Jane doe has a supervisor who is John Doe, then Jane Doe's record displays as below

Fname Lname  Value1 Value2 Supervisorid
Jane      Doe         val       val           17

We now in the second query find who is the person who is mapped to "17"

This is what you need to resolve now to get this working as expected,  I suggested a way to do this above.
0
 

Author Comment

by:JohnMac328
ID: 38779042
This gives the same result

<cfquery name="getSupervisor" datasource="#datasource#">
      SELECT   *
FROM         employee_dataTest
WHERE     (leader_coach = 1) OR
                      (supervisor = 1) AND (active_account = 1) AND (IDassignedsupervisor = Supervisor_ID)
</cfquery>

 <CFLOOP QUERY="getSupervisor">
             <select name="SuperVisorID">
             <option value="#supervisor_ID#">#getSupervisor.last_name#,#getSupervisor.first_name#</option>
             </select>
      </cfloop>
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 
LVL 28

Expert Comment

by:becraig
ID: 38779057
Why not simply use
<cfquery name="getSupervisor" datasource="#datasource#">
      SELECT   *
FROM         employee_dataTest
WHERE (IDassignedsupervisor = Supervisor_ID)
</cfquery>

since there should be no duplicate entries for this value ?
0
 

Author Comment

by:JohnMac328
ID: 38779073
It is still displaying like the image I uploaded - multiple supervisors for one record - makes no sense.
0
 
LVL 28

Expert Comment

by:becraig
ID: 38779129
Try using:
WHERE (IDassignedsupervisor = #firstquery.Supervisor_ID#)
0
 
LVL 28

Expert Comment

by:becraig
ID: 38779135
Let me play with it in a few and come up with something it seems tweaking the query and the loop are the only thing left here to do and you will have the result you need.
0
 

Author Comment

by:JohnMac328
ID: 38779148
Still the same - I think I will just create another table to get it to display
0
 

Author Comment

by:JohnMac328
ID: 38779151
Ok - sounds good - no great hurry yet
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38779291
Just catching up.

I try this ... And I get what the image shows

It's only because your loop is in the wrong place.  It's generating 1 select list for each record in the query.  Move it inside the <select> tag.  Also, you *must* scope all of the query columns. Otherwise they may conflict with those in your outer cfoutput loop. Something like this

<select name="SuperVisorID">
     <cfloop query="getSupervisor">
             <option value="#getSupervisor.employee_ID#">
                        #getSupervisor.last_name#,#getSupervisor.first_name#
              </option>
     </cfloop>
</select>

> should display all the supervisors

So you want the <select> to list all *possible* supervisors. But pre-select the employee's current supervisor.  

I still don't think you need another table ... you just need the right query and CF code.

So what determines which records represent a supervisor? (The WHERE clause has a lot of filters like supervisor = 1, leader_coach = 1, etc...). I'm not sure which ones you really need.
0
 

Author Comment

by:JohnMac328
ID: 38779338
The supervisor_ID field shows the ID number of the supervisor for the employee - for example

Employee Jane Doe with and employee ID of 10

Employee John Doe with an ID and a Supervisor ID 0f 20

Employee Jane Doe has in her record a value of 20 in her Supervisor ID field

I want the name John Doe to appear on the screen when someone is looking at her record and not the number 20

With the change I get the same supervisor for everyone.

 <select name="SuperVisorID">
     <cfloop query="getSupervisor">
             <option value="#getSupervisor.supervisor_ID#">
                        #getSupervisor.last_name#,#getSupervisor.first_name#
              </option>
     </cfloop>
</select>

<cfquery name="getSupervisor" datasource="#datasource#">
      SELECT   *
FROM         employee_dataTest
WHERE     (leader_coach = 1) OR
                      (supervisor = 1) AND (active_account = 1) AND (IDassignedsupervisor = #getEmployees.Supervisor_ID#)
</cfquery>
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38779429
>   (IDassignedsupervisor = #getEmployees.Supervisor_ID#)

It's likely because of that line.  Don't query within a loop. What you need to do is run two queries, *outside* any loops. One to get all employees. The other to get *possible* supervisors.  

<cfquery name="getAllEmployess">
        query to get ALL employees
</cfquery>
<cfquery name="getAllSupervisors">
        query to get ALL supervisors (not just one)
</cfquery>

Then loop through the results to generate the form fields

<cfoutput query="getAllEmployess">
        show current employee
       <select name="SuperVisorID">
              <cfloop query="getAllSupervisors">
              <option value="#getAllSupervisors.ID#">
                        #getAllSupervisors.last_name#,#getAllSupervisors.first_name#
              </option>
             </cfloop>
       </select>

</cfoutput>
0
 
LVL 28

Expert Comment

by:becraig
ID: 38779450
i am guessing at that point we will have to evaluate with an if or some other statement if supervisorid from query1 = issupervisor from query2 then display
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38779472
Not to display no. Just to "pre-select" the current supervisor.  My understanding is he wants the list to display all supervisors. (Wouldn't really make much sense to create a <select> list with only one item).

But pre-selecting is simple. I'd get the basic form working first.
0
 

Author Comment

by:JohnMac328
ID: 38779481
I thought I might just make a supervisor table and use the join query to grab the field to display
0
 
LVL 28

Expert Comment

by:becraig
ID: 38779513
I get where agx is going here (I like it) less headache - less overhead as well.

You simply populate the select box with ALL supervisors and you select the relevant supervisor when making your edit.
0
 

Author Comment

by:JohnMac328
ID: 38779568
Like this?

  <cfoutput query="getEmployees">
     
<cfform method="post" style="margin:0px" action="Admin.cfm">


      <cfinput type="hidden" name="ID" value="#ID#">
<tr>
<td><cfinput type="text" name="first_name" value="#first_name#" size="10"></td>
             <td><cfinput type="text" name="middle_name"  value="#middle_name#"   size="1"/></td>
          <td><cfinput type="text" name="last_name" value="#last_name#"   size="15"/></td>
          <td><cfinput type="text" name="main_dept"  value="#main_dept#"   size="2"/></td>
          <td><cfinput type="text" name="job_title"  value="#job_title#"   size="30"/></td>  
          <td><cfinput type="text" name="phone_ext"  value="#phone_ext#"   size="3"/></td>
          <td><cfinput type="text" name="email_name"  value="#email_name#"   size="15"/></td>
          <td><cfinput type="text" name="birth_month"  value="#birth_month#"   size="2"/></td>
          <td><cfinput type="text" name="birth_date"  value="#birth_date#"   size="2"/></td>
          <td><cfinput type="text" name="payroll_num"  value="#payroll_num#"   size="6"/></td>
          <td>
   
       <select name="SuperVisorID">
              <cfloop query="getSupervisor">
              <option value="#getSupervisor.supervisor_ID#">
                        #getSupervisor.last_name#,#getSupervisor.first_name#
              </option>
             </cfloop>
       </select>

            </td>            
           <td>
        <cfinput type="submit" name="editing"
                  value="EDIT" style="font-size:xx-small">
               </td>
           <td>
            <cfinput type="submit" name="deleting"
                  value="Inactivate" style="font-size:xx-small">
            </td>
            </tr>
</cfform>
</cfoutput>  

It gives me one supervisor for all
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38779581
> It gives me one supervisor for all

Not possible, unless you forgot to remove the WHERE clause filters from the getSupervisor query.  Remember it should return *all possible* supervisors. Does it? Dump that query and check.

In other words, verify the queries contain the right data first. If they don't, the form will definitely be wrong. So there's no point testing the form code yet.
0
 

Author Comment

by:JohnMac328
ID: 38779594
It's correct - 15 show up in the dropdown - it defaults to the first one in the list - I should have been more clear - I meant to say it gives the first supervisor for all
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38779595
> it defaults to the first one in the list - I should have been more clear -
> I meant to say it gives the first supervisor for all

(EDIT)  Good. That's what should happen. We just need to add code to pre-select the current supervisor which we didn't add yet.  Give me a minute
0
 

Author Comment

by:JohnMac328
ID: 38779611
That is how it reads now
0
 

Author Comment

by:JohnMac328
ID: 38779614
I see - no problem
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38779621
>  <option value="#getSupervisor.supervisor_ID#">

Quick note, shouldn't that be "ID"?  Otherwise, you're using the ID  of the supervisor's - supervisor (ie grandparent rather than parent). If that makes sense ;-)

Assuming it should be "ID", use this code for the select instead:

      <!--- get supervisor of current employee --->
     <cfset currSupervisorID = getEmployees.supervisor_ID>
     <select name="SuperVisorID">
              <cfloop query="getSupervisor">
              <option value="#getSupervisor.ID#"
                    <!--- preselect current supervisor --->
                    <cfif getSupervisor.ID eq currSupervisorID>selected</cfif>
                     >#getSupervisor.last_name#,#getSupervisor.first_name#
              </option>
             </cfloop>
       </select>

Edit: Sorry for doing it in steps, but it seemed we were all on different wavelengths.. Confirming each step is working as expected seemed the quickest way to get things back on track.
0
 

Author Comment

by:JohnMac328
ID: 38779972
Ok that seems to be correct but it needs to be in a text box - the dropdown shows the first one in the list in correct records but the rest are blank - when I click the dropdown the correct name is there but does not display -

I am having trouble with the syntax for a text box with a query

<cfset currSupervisorID = getEmployees.supervisor_ID>
<td><cfloop query="getSupervisor"><cfinput type="text" name="SuperVisorID"  value="<cfif getSupervisor.ID eq currSupervisorID>#getSupervisor.last_name#,#getSupervisor.first_name#</cfif>"   size="6"/>  </cfloop></td>
0
 
LVL 52

Expert Comment

by:_agx_
ID: 38780040
Sorry but I'm totally confused now :/ ... (and have a meeting now).

As long the query contains first and last names for every supervisor, there's no reason they'd be blank. Not unless there's an error in the CF code, like a misaligned CFIF or something. I use this same technique all the time and it works perfectly.

Are you trying to create a text box because you can't make the list work? Because the current query makes no sense with a text box. You will just end up with multiple text boxes - one for each row in getSupervisor. Plus users won't be able to change the supervisor.

Can you post your complete code (the version with the list)? I have a feeling it's doing something different about than what I posted earlier.  Maybe someone else can spot it while I'm away.
0
 

Author Comment

by:JohnMac328
ID: 38780075
Ok but in a nutshell the first one in the list appears correctly - all the others "are there" only when you click on the dropdown and they show like the picture - and they are correct they just need to move up the list to display properly
example2.jpg
0
 

Author Comment

by:JohnMac328
ID: 38780112
Here is the code

 
 <cfquery name="getEmployees" datasource="#datasource#">
select * from employee_dataTest
</cfquery>
<cfquery name="getSupervisor" datasource="#datasource#">
 SELECT *
      FROM         employee_dataTest
      WHERE     leader_coach = 1 OR
                      ((supervisor = 1) AND (active_account = 1))
</cfquery>
 
 
 
 
 <cfoutput query="getEmployees">
  <cfform method="post" style="margin:0px" action="Admin.cfm">
    <cfinput type="hidden" name="ID" value="#ID#">
    <tr>
      <td><cfinput type="text" name="first_name" value="#first_name#" size="10"></td>
      <td><cfinput type="text" name="middle_name"  value="#middle_name#"   size="1"/></td>
      <td><cfinput type="text" name="last_name" value="#last_name#"   size="15"/></td>
      <td><cfinput type="text" name="main_dept"  value="#main_dept#"   size="2"/></td>
      <td><cfinput type="text" name="job_title"  value="#job_title#"   size="30"/></td>
      <td><cfinput type="text" name="phone_ext"  value="#phone_ext#"   size="3"/></td>
      <td><cfinput type="text" name="email_name"  value="#email_name#"   size="15"/></td>
      <td><cfinput type="text" name="birth_month"  value="#birth_month#"   size="2"/></td>
      <td><cfinput type="text" name="birth_date"  value="#birth_date#"   size="2"/></td>
      <td><cfinput type="text" name="payroll_num"  value="#payroll_num#"   size="6"/></td>
      <td>
      
      <cfset currSupervisorID = getEmployees.supervisor_ID>
        <select name="SuperVisorID">
          <cfloop query="getSupervisor">
            <option value="#getSupervisor.ID#"> 
            <!--- preselect current supervisor --->
            <cfif getSupervisor.ID eq currSupervisorID>
              #getSupervisor.last_name#,#getSupervisor.first_name#
            </cfif>
            </option>
          </cfloop>
        </select></td>
        
      <td><cfinput type="submit" name="editing"
			value="EDIT" style="font-size:xx-small"></td>
      <td><cfinput type="submit" name="deleting"
			value="Inactivate" style="font-size:xx-small"></td>
    </tr>
  </cfform>
</cfoutput> 

Open in new window

0
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
ID: 38780498
<cfif getSupervisor.ID eq currSupervisorID>
              #getSupervisor.last_name#,#getSupervisor.first_name#
            </cfif>

Yeah, it's because the cfif is wrong. Notice in my earlier example the name is outside the cfif? I can't test this right now, but it should be more like this:

<!--- get supervisor of current employee --->
     <cfset currSupervisorID = getEmployees.supervisor_ID>
     <select name="SuperVisorID">
              <cfloop query="getSupervisor">
              <option value="#getSupervisor.ID#"
                    <!--- preselect current supervisor --->
                    <cfif getSupervisor.ID eq currSupervisorID>selected</cfif>>
                     #getSupervisor.last_name#,#getSupervisor.first_name#
              </option>
             </cfloop>
       </select>
0
 

Author Closing Comment

by:JohnMac328
ID: 38780510
I thought that was a typo because the color coding was off- thanks once again agx
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now