Adobe Dreamweaver Forums



Last 10 THreads :         x and y into Latitude and longitdue (Last Post : Ayush.Jain - Replies : 10 - Views : 11 )           »          Site Map problem (Last Post : Kcheval - Replies : 0 - Views : 1 )           »          Image icons disappear when CPD is deleted (Last Post : Peter Grainge - Replies : 1 - Views : 2 )           »          FMS3 Linux and virtual host (Last Post : RussianMedved - Replies : 0 - Views : 1 )           »          Flash Media Server 2.0 (Last Post : Ajay P - Replies : 3 - Views : 13 )           »          Advanced datagrid using Remote Objects (Last Post : rkcy - Replies : 0 - Views : 1 )           »          Unable to create SWC in Flash CS4 (Last Post : ChickenSupreme - Replies : 0 - Views : 1 )           »          Extension Manager CS4 not installing extensions inDreamweaver CS4 (Last Post : Tom Dupre - Replies : 16 - Views : 17 )           »          Upsized Access DB not playing friendly (Last Post : Dooza - Replies : 1 - Views : 2 )           »          FLV won't work (Last Post : mixmasterdsr04 - Replies : 0 - Views : 1 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Other Macromedia/Adobe Products > Cold Fusion
 
Tags: , , ,



Reply
  #1 (permalink)  
Old 08-28-2008, 06:13 PM
Art of Zen
 
Posts: n/a
Diggs:
Default How to Insert Blank Record in Array?

I have a function shown below that is part of a two selects related Component.
My first problem is if no data is passed to the argument, the select field
bound to the function is very tiny (I would like it to have a default width).
Adding a "width" does not work.

SECONDLY, if there is data passed to the argument (in Arguments.accountID, i
would like to have a blank record inserted at the top of the select list
results. So in summary, if no data is passed to the argument, the select field
is very small. If data is passed to the argument, the select list is
populated, but I need to have a blank record (option) at the top of the select
list.

The code for the function shown below:

<cffunction name="getUsers" access="remote" returnType="array">
<cfargument name="accountID" type="string" required="yes">
<!--- Define variables --->
<cfset var data="">
<cfset var result=ArrayNew(2)>
<cfset var i=0>
<cfset data1= oSF.QueryObject("select ID , name, Email, ACCOUNTID__C from
User").results>

<cfquery dbtype="query" name="data">
SELECT ID, NAME, ACCOUNTID__C
FROM DATA1
WHERE ACCOUNTID__C = '#arguments.accountID#'
</cfquery>


<!--- Convert results to array --->
<cfloop index="i" from="1" to="#data.recordcount#">
<cfset result[i][1]=data.id[i]>
<cfset result[i][2]=data.name[i]>
</cfloop>
<!--- And return it --->
<cfreturn result >
</cffunction>

Code for select list:


<cfselect name="Contacts"
bind="cfc:getPartners.getUsers({mediaid})"
tooltip="Select Partner Rep" onError=""
width="50"/>




Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 08-28-2008, 06:13 PM
Azadi
 
Posts: n/a
Diggs:
Default Re: How to Insert Blank Record in Array?

1) style="width:50px;"

2)
<cfif data.recordcount>
<cfset result[1][1] = "">
<cfset result[1][2] = "">
<!--- Convert results to array --->
<cfloop index="i" from="1" to="#data.recordcount#">
<cfset result[i+1][1]=data.id[i]>
<cfset result[i+1][2]=data.name[i]>
</cfloop>
</cfif>

hth

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Reply With Quote
  #3 (permalink)  
Old 08-28-2008, 07:53 PM
Dan Bracuk
 
Posts: n/a
Diggs:
Default Re: How to Insert Blank Record in Array?

Change this:

SELECT ID, NAME, ACCOUNTID__C
FROM DATA1
WHERE ACCOUNTID__C = '#arguments.accountID#'

to this
select distinct '' id, '' name, '' accountid_c
from some_small_table
union
SELECT ID, NAME, ACCOUNTID__C
FROM DATA1
WHERE ACCOUNTID__C = '#arguments.accountID#'
order by id

if any of those fields are not text, use whatever db function is appropriate
to convert to string in the bottom half of the query

Reply With Quote


  #4 (permalink)  
Old 08-28-2008, 11:41 PM
Art of Zen
 
Posts: n/a
Diggs:
Default Re: How to Insert Blank Record in Array?

Thank you! This was the answer for inserting that blank record!
Reply With Quote
  #5 (permalink)  
Old 08-28-2008, 11:41 PM
Art of Zen
 
Posts: n/a
Diggs:
Default Re: How to Insert Blank Record in Array?

Thanks for the style answer! the array did not work, but your solution for adding a style to the select certainly helped!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 09:36 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk