CFLOOP In CFGRID

I am populating the grid from a query that displays the
perosn's name, date of attachment and attachment name, etc etc. I
am offering the option to delete these attachments based on two
criteria.
1. The session.role is the administrator role.
2. The owner of the attachment (the person that put it up)
can delete the attachment.
The problem I am having is that more than one person can add
an attachment to the file. I want to be able to limit the items
they can delete to those that they put up. Is it possible to cfloop
through the grid so if the person is the owner I can give them the
check box, if they are not the owner it is inactive. Here is the
code I am working with:
<cfgrid name="attachmentList" query="attachmentsQuery"
height="220" rowheaders="false"
onchange="#launchAttachment#" selectmode="edit">
<!--- Delete Only If Session. Role is 10 Or session.admin
is Owner --->
<cfif session.role EQ 10>
<Cfset enable = "yes">
<cfelseif Session.admin IS
#trim(attachmentsQuery.AttachOwner)#>
<Cfset enable = "yes">
<Cfelse>
<Cfset enable = "no">
</cfif>
<cfgridcolumn name="checked" header="Delete"
type="boolean" width="46" display="#enable#"/>
<cfgridcolumn name="AttachOwner" display="no">
<cfgridcolumn name="AttachID" display="no">
<cfgridcolumn name="AttachName" header="Attachment"
select="no" />
<cfgridcolumn name="Name" header="Attached By"
select="no" />
<cfgridcolumn name="DateTimeKey" header="Attach Date"
mask="MM/DD/YYYY" select="no" />
<cfgridcolumn name="AttachmentType" header="Attach Type"
select="no" />
</cfgrid>

You you can use CFML inside of a JavaScript <script..> block to dynamically build the JavaScript code to send to the client.  It is a very powerful technique for building highly interactive web sites.
Just realize that all the JavaScript code is going to be completely built by the CFML and then sent to the browser client through the web server where the JavaScript is executed completely independent of anything that is running on the server.  The JavaScript can not read or write variables on the server or vice-a-versa.  But it is quite easy to export variable values from ColdFusion to JavaScript.  It is a bit more work to export variable values back requiring either the browser or JavaScript to make a new request of the server to send the data.  AJAX does allow this to happen behind the scenes making it look like the data is being shared.  But in reality it is being passed back and forth with independent HTTP requests and responses.
A recent discussion on this topic:
http://forums.adobe.com/message/1957350#1957350

Similar Messages

  • Cfgrid prepopulate cfselect

    I have trouble prepolualting cfselect in the flash form. When
    i click on the cfgrid I want specific drop down to be prepopulated
    (i have 18 of them) based on the type.
    Here is my cfgrid
    <cfgrid name="myGrid" query="tempQuery" height="445"
    width="200" rowheaders="false" onchange="#getComboBoxValue#">
    <cfif menuQuery.menuID is not lloc>
    <cfgridcolumn name="menuID" header="menuID" display="no"
    />
    <cfgridcolumn name="label" header="label" />
    <!--- <cfgridcolumn name="link" header="link"
    />--->
    <cfset lloc= menuQuery.menuID>
    </cfif>
    </cfgrid>
    And here is the drop downs
    <cfloop index="i" list="#lLIst#">
    <cfscript>
    LoadaccessLevelType =
    createObject("component","Erik.maintenace").LoadaccessLevelType(#i#);
    </cfscript>
    <cfselect query="LoadaccessLevelType" value="accessLevel"
    display="description" name="access#i#" width="200"
    label="#LoadaccessLevelType.display#"/>
    </cfloop>
    Where lList is number from 1 to 18.
    My actionScript is here
    <cfsavecontent variable="getComboBoxValue">
    <cfloop query="TempQuery">
    <cfif TempQuery.accessType neq ''>
    //Set a temp variable to hold the current comboBox value
    var temp1;
    //Loop through all the comboBox values
    for(var i = 0; i < access#accessType#.length; i++){
    //if (myGrid.selectedItem.accessType == temp1) {
    //set the comboBox to the current index
    access#accessType#.selectedIndex=i;
    //set temp to the value of the comboBox
    temp1=access#accessType#.value;
    //if temp equals the selected clientID then stop looping
    through the comboBox
    if(temp1==myGrid.selectedItem.accessValue){
    break;
    </cfif>
    </cfloop>
    </cfsavecontent >

    There are too many things going on: function call on an
    object instance, actionscript function stored in a variable and the
    grid itself. It is difficult to debug. I would start by using an
    actual query to test the code.

  • Embedding image and multiple queries in cfgrid

    I have a datagrid that displays a user's work history pulled
    from one query. In the original HTML table set up, a status icon
    for each work item was displayed as either "New", 'Needs Attention"
    or "Archived". This status was determined by using a value from the
    first query as a filter in the WHERE clause of the second query:
    ------------------- Original Query -------------------------
    <cfquery datasource="#application.defaultdsn#"
    name="qQuestions">
    SELECT discussions.dateSubmitted, discussions.discussionID,
    discussions.subjectID, discussions.topic, users.firstName + ' ' +
    users.lastName AS stName,
    subjects.subjectID AS Expr1, subjects.subject
    FROM discussions INNER JOIN
    users ON discussions.userID = users.userid INNER JOIN
    subjects ON discussions.subjectID = subjects.subjectID
    WHERE 0=0
    <cfif getDiscussionIDs.recordCount GT 0>
    AND (
    <cfloop query="getDiscussionIDs">
    discussions.discussionID = #getDiscussionIDs.discussionID#
    <cfif getDiscussionIDs.currentRow NEQ
    getDiscussionIDs.recordCount>OR</cfif>
    </cfloop>
    <cfelse>
    AND 0=1
    </cfquery>
    ------------------------ Queries used to determine status
    <cfquery datasource="#application.defaultdsn#"
    name="LatestMessage">
    SELECT Max(discussionPosts.postID) AS NewestMessage
    FROM discussionPosts
    WHERE discussionPosts.discussionID =
    #qQuestions.discussionID#
    </cfquery>
    <cfset variables.userTypetoView = "tutor">
    <!--- <cfif LatestMessage.recordCount --->
    <cfquery datasource="#application.defaultdsn#"
    name="getLastInfo">
    SELECT discussionPosts.userType,
    discussionPosts.dateSubmitted, discussionPosts.viewerID
    FROM discussionPosts
    WHERE discussionPosts.postID = #LatestMessage.NewestMessage#
    </cfquery>
    My question is how can I emulate this same status icon setup
    in a cfgrid? I used the following ActionScript to create a new
    column in the grid and return a string. However, this new column
    must logically know how to display the correct status IMAGE for
    each corresponding row. As you can see, there are no database
    tables for storing the status - which would have made this much
    easier.
    function setStat(){
    eQArchive.getColumnAt(1).labelFunction = statIcon;
    function statIcon(item
    bject, columnName:String): String{
    if (item[columnName] != undefined) {
    return asIcon;
    else {
    return "";
    I also tried using the toScript() function in CF7 to see if I
    can set a variable equal to the appropriate image and then return
    it in the above script, but this is where I am at a loss.
    <cfif getLastInfo.recordCount GT 0 AND
    Trim(getLastInfo.userType) EQ "tutor">
    <cfset stat = "/images/docArchive.jpg">
    <script language="javascript" type="text/javascript">
    <cfoutput>var #toScript(getLastInfo, "asIcon",
    True)#;</cfoutput>
    </script>
    <cfelseif getLastInfo.viewerID EQ session.tutorID>
    <cfset stat = "/images/docNew.jpg">
    <script language="javascript" type="text/javascript">
    <cfoutput>var #toScript(getLastInfo, "asIcon",
    True)#;</cfoutput>
    </script>
    <cfelse>
    <cfset stat = "Green">
    <script language="javascript" type="text/javascript">
    <cfoutput>var #toScript(getLastInfo, "asIcon",
    True)#;</cfoutput>
    </script>
    </cfif>
    Any ideas on how to get this working is greatly appreciated.
    Thank you in advance.

    Hi Mike,
    To insert multiple queries in a single woorkbook.
    In the Business Explore --> Analyser --> Open the first query and then click on tools button of the BEx add on components and select the option ( Insert Query ).
    Reg's,
    Pratap Reddy Bodimalla.

  • CFGRID shifting column values

    Hi,
    I have a CFGRID that has 5 columns in which its values are
    obtained from the database. There is a single submit button that
    would submit to a processor page that updates any records with
    changed cells. The problem that I'm having is that the processor
    page would shift the values of the columns one over. For example,
    the value of column 4 would display as column 3 on the processor
    page. Below is the code:
    cfgrid page:
    <cfform method="post" name="adcost"
    action="index.cfm?fuseaction=process_advertising_cost_grid">
    <cfgrid name="advertizingCosts"
    format="HTML"
    query="advertizingcosts"
    selectMode="edit"
    colHeaders="true"
    colHeaderBold="yes"
    width="600"
    maxRows="25"
    stripeRows="yes"
    stripeRowColor="efefef"
    >
    <cfgridcolumn name="AdvertizingCostsID" header="ID"
    width="20" select="no">
    <cfgridcolumn name="AdvertizingCostsDate"
    header="Advertizing Costs Date" mask="MMMM D, YYYY" width="160">
    <cfgridcolumn name="Amount" header="Amount"
    width="60">
    <cfgridcolumn name="Details" header="Details">
    <cfgridcolumn
    name="StoreFrontName"
    header="StoreFront"
    width="150"
    values="#ValueList(storefronts.StoreFrontCode)#"
    valuesDisplay="#ValueList(storefronts.StoreFrontName)#"
    >
    </cfgrid>
    <input type="submit" value="submit" class="button" />
    </cfform>
    processor page:
    <cfif
    IsDefined("form.advertizingCosts.RowStatus.Action")>
    <cfloop index="counter" from="1"
    to="#ArrayLen(form.advertizingCosts.RowStatus.Action)#">
    <cfoutput>
    <p>
    counter is #counter#<br />
    The row action for #counter# is
    #form.advertizingCosts.RowStatus.Action[counter]#<br />
    AdvertizingCostsID is
    #form.advertizingCosts.AdvertizingCostsID[counter]#<br />
    AdvertizingCostsDate is
    #form.advertizingCosts.AdvertizingCostsDate[counter]#<br />
    Amount is #form.advertizingCosts.Amount[counter]#<br
    />
    Details is #form.advertizingCosts.Details[counter]#<br
    />
    StoreFrontName is
    #form.advertizingCosts.StoreFrontName[counter]#
    </p>
    <cfif #form.advertizingCosts.RowStatus.Action[counter]#
    eq "U">
    <pre>
    Original AdvertizingCostsDate:
    #form.advertizingCosts.Original.AdvertizingCostsDate[counter]#
    Original Amount:
    #val(form.advertizingCosts.Original.Amount[counter])#
    Original Details:
    #form.advertizingCosts.Original.Details[counter]#
    Original StoreFrontName is
    #form.advertizingCosts.Original.StoreFrontName[counter]#
    </pre>
    <cfelse>
    </cfif>
    </cfoutput>
    </cfloop>
    </cfif>
    The Amount data would end up going to the details column, the
    date appears as the amount on the second page. This page only
    displays values.
    It looks to be correct, but I'm not sure what is causing the
    shifting.
    Any help would be great!
    Jason

    This fixed it for me. Only do this if you have version 9.01 of coldfusion.
    Open cfide/scripts/ajax/package/grid.js
    find this line of code
    var _5aa=$G.computeActualRow_editField(this.editFieldState,this.selectedRow);    (IT is in the $G.Actions.afterEdit=function(_5a8))
    change it to
    var _5aa=$G.computeActualRow_editField(this.editFieldState,_5a8.row+1);
    every thing should now be in sync

  • Error:widget: CFGRID: Response is empty

    I've an error on the Coldfusion Ajax logger : "error:widget:
    CFGRID: Response is empty". The headings of the cfgrid appear but
    the contents not.
    Here the Coldfusion Ajax logger answer :
    - info:widget: Data loaded for grid, id: refTableau
    - error:widget: CFGRID: Response is empty
    - info:http: CFC invocation response:
    - info:widget: Creating window: cf_window1191833821003
    - info:widget: Created grid, id: refTableau
    - info:http: HTTP GET
    /bulte/admin/produits/gridDataManager.cfc?method=getData&returnFormat=json&argumentCollec tion=%7B%22page%22%3A1%2C%22pageSize%22%3A5%2C%22gridsortcolumn%22%3A%22%22%2C%22gridsortd irection%22%3A%22%22%2C%22idTableau%22%3A%22772%22%7D&_cf_nodebug=true&_cf_nocache=true&_c f_clientid=59BF758DB52E56355D649B34E232903B&_cf_rc=0
    - info:http: Invoking CFC:
    /bulte/admin/produits/gridDataManager.cfc , function: getData ,
    arguments:
    {"page":1,"pageSize":5,"gridsortcolumn":"","gridsortdirection":"","idTableau":"772"}
    - info:LogReader: LogReader initialized
    - info:global: Logger initialized
    Here my cfm page code:
    <cfparam name="URL.id" default="">
    <cfquery name="qRec" datasource="#APPLICATION.db#">
    SELECT *
    FROM Produits
    WHERE id=<cfqueryparam cfsqltype="cf_sql_integer"
    value="#URL.id#">
    </cfquery>
    <cfset FORM.refTableau=qRec.refTableau>
    <cfset MyXmlCode=FORM.refTableau>
    <cfset mydoc = XmlParse(MyXmlCode)>
    <cfset nbcolumns =
    ArrayLen(mydoc.table.tr.XmlChildren)>
    <cfset numLines = ArrayLen(mydoc.table.XmlChildren)>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <title>fdgdfgdfgdfg</title>
    <link rel="stylesheet" href="../admin.css" />
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    </head>
    <cfwindow width="900" height="600" center="true"
    resizable="false" draggable="true" initshow="true"
    closable="false">
    <cfform name="editForm" action="ifr_refTableau.cfm"
    method="post" format="html">
    <cfgrid format="html"
    name="refTableau"
    pagesize="5"
    sort="yes"
    selectmode="edit"
    delete="yes"
    bind="cfc:gridDataManager.getData({cfgridpage},{cfgridpagesize},{cfgridsortcolumn},{cfgri dsortdirection},'#URL.id#')"
    onchange="cfc:gridDataManager.editData({cfgridaction},
    {cfgridrow}, {cfgridchanged})">
    <cfloop from="1" to="#nbcolumns#" index="k">
    <cfgridcolumn name="Col_#k#" header="#k#" display="yes"
    />
    </cfloop>
    </cfgrid>
    </cfform>
    </cfwindow>
    </body>
    </html>
    My cfc code :
    <cfcomponent>
    <cfset THIS.dsn="clients">
    <cffunction name="getData" access="remote"
    output="false">
    <cfargument name="page" required="yes">
    <cfargument name="pageSize" required="yes">
    <cfargument name="gridsortcolumn" required="no">
    <cfargument name="gridsortdirection" required="no">
    <cfargument name="idTableau" required="yes">
    <cfquery name="qRec" datasource="#THIS.dsn#">
    SELECT refTableau
    FROM Produits
    WHERE id=<cfqueryparam cfsqltype="cf_sql_integer"
    value="#ARGUMENT.idTableau#">
    </cfquery>
    <!--- Convert file to XML document object --->
    <cfset MyXmlCode=qRec.refTableau>
    <cfset mydoc = XmlParse(MyXmlCode)>
    <cfset numItems =
    ArrayLen(mydoc.table.tr.XmlChildren)>
    <cfset numLines = ArrayLen(mydoc.table.XmlChildren)>
    <!--- Process the order into a query object --->
    <cfset listHeader="">
    <cfloop from="1" to="#numItems#" index="i">
    <cfset listHeader=ListAppend(listHeader, "Col_#i#")>
    </cfloop>
    <cfset queryDatas = QueryNew(listHeader)>
    <cfset temp = QueryAddRow(queryDatas, numLines)>
    <cfloop index="i" from="1" to ="#numLines#">
    <cfloop from="1" to="#numItems#" index="j">
    <cfset temp = QuerySetCell(queryDatas,
    ListGetAt(listHeader, j), mydoc.table.tr
    .td[j].XmlText, i)>
    </cfloop>
    </cfloop>
    <cfquery name="qReturn" dbtype="query">
    SELECT *
    FROM queryDatas
    <cfif ARGUMENTS.gridsortcolumn neq "" or
    ARGUMENTS.gridsortdirection neq "">
    ORDER BY #ARGUMENTS.gridsortcolumn#
    #ARGUMENTS.gridsortdirection#
    </cfif>
    </cfquery>
    <cfreturn QueryConvertForGrid(qReturn, ARGUMENTS.page,
    ARGUMENTS.pageSize)>
    </cffunction>
    <cffunction name="editData" access="remote"
    output="false">
    <cfargument name="gridaction">
    <cfargument name="gridrow">
    <cfargument name="gridchanged">
    </cffunction>
    </cfcomponent>
    <body>
    I don't understand why the return is empty.

    I have the same problem. When the function is removed, the
    query return many line of data, but when the queryconverforgrid is
    added, the grid has the same number of line but all fields are
    empty. Can someone please help???

  • Flash CFGRID Skipping Every Third Column

    I can't figure out why this is doing this... I have a cfform that contains a cfgrid. When I make that cfgrid an applet, all my columns show up just fine, and as I expect them to. However, I like the flash form a lot better, so I converted my code to flash. But when I converted to flash, suddenly every third column shows up as blank. If I set the colum to select="yes" and I select that area, suddenly I see the right values with a bunch of leading spaces. Below is the code. I have tried everything imaginable to get this to work but it just is not happening. Any help is greatly appreciated:
        <cfgrid name="cartItems"  width="800" selectMode="edit" delete="yes" deletebutton="Update Cart"  rowheaders="no">
            <cfgridcolumn name="quant" header="Quantity" select="no" type="numeric">
            <cfgridcolumn name="itemName" header="Item Name" select="no" type="string_nocase" >
            <cfgridcolumn name="itemDescription" header="Item Description" dataalign="center" select="true" type="string_nocase">
            <cfgridcolumn name="itemPrice" header="Item Price" select="no" type="currency">   
            <cfgridcolumn name="totalPrice" header="Total" select="no" type="currency">
            <cfif isCurrency>
                <cfgridcolumn name="currencyNeeded" header="Cost in #currencyName#" type="numeric">
            </cfif>
            <cfgridcolumn name="checked" header="Delete" type="boolean" width="46" select="yes" >         
            <cfloop index="i" from="1" to="#ListLen(offerName)#">
                <cfif NOT isCurrency>
                        <cfgridrow data="#ListGetAt(quant, i)#, #ListGetAt(offerName, i)#,
                                        #ListGetAt(offerDescription, i)#,
                                        #ListGetAt(price, i) * ListGetAt(quant, i)#,
                                        #ListGetAt(price, i)#">
                <cfelse>
                    <cfset currencyRequired = currencyPerDollar * #ListGetAt(price, i)#>
                    <cfgridrow data="#ListGetAt(quant, i)#, #ListGetAt(offerName, i)#,
                                        #ListGetAt(offerDescription, i)#, #ListGetAt(price, i)#,
                                        #ListGetAt(price, i) * ListGetAt(quant, i)#,
                                        #currencyRequired#">
                </cfif>           
            </cfloop>       
            </cfgrid>
    Here is what I get in when the form is set to Flash:
    As you can see, I am missing item description.
    I have another verision that runs based on a <cfif>. When that one runs, I get the following:
    Notice that it's always the third colum that is being truncated. However, if I select the cell, the values are really there... they are just not showing up.
    Can someone please help with this? I really appreciate any instruction you can give.
    Al

    Thanks again. After reading some more Oracle chapters and using EM I scheduled an immediate full backup and selected the options that deleted the archived logs from disk after they are successfully backed up; and deleted obsolete backups. This cleared the \ArchiveLog directory from 25GB to around 150MB. However the full backup of databases totalling 9GB came to 20GB..I am not sure if this is correct..
    More background info:
    I'm not a DBA and don't have a DB background but I am responsible for the server infrastructure so do need to ensure that we have a good backup/recovery strategy.
    This is the only Oracle server we have and is quite small scale at present.
    We do not use a tape backup system. Instead we use a hard disk based backup, Evault. Using its proprietry technology it in effect gives us a 'full' physical backup each evening across our WAN.
    With SQL I have backup strategy for each database that means that an SQL .dmp file is created each evening and based upon our evening backup strategy means that we get another level of version control should we need to recover.
    I would like a similar type solution here:
    - To have a once weekly full backup ie) Friday evening. The remaining 6 evenings are incremental. The backups will be directed to the server hard drive.
    - To have a retention period of 31 days
    We will also have the additional version control from the server backup. Does this sound a reasonable strategy?
    Is this achievable through EM using the scheduled backup option?
    Thanks, MJ

  • Cfgrid and rowStatus.Action

    I posted this under 'Rich Forms' as well (just trying to
    cover all the bases).
    I'm having a problem pulling out the rowstatus property using
    actionscript. If I use the following lines of code I receive an
    appropriate response (ie: the Index and value of contactD will
    appear in the Alert box):
    var varIndex = findReferenceResults.getSelectedIndex();
    var varID =
    _root.findReferenceResults.getItemAt(varIndex).contactID;
    alert('Variable Index: ' + varIndex);
    alert('contactID: ' + varID);
    However, when I try this:
    var varIndex = findReferenceResults.getSelectedIndex();
    var varID =
    findReferenceResults.getItemAt(varIndex).rowStatus.Action;
    alert('Variable Index: ' + varIndex);
    alert('Rowstatus: ' + varID);
    I still get my Index value, but the rowstatus.Action value
    comes back as 'undefined'.
    In the past, I've used cfgrid with cfgridupdate and with
    cfif/cfloop could determine which rows were marked for
    insertion/deletion/editing. I'm now switching over to flash forms,
    but I'm at a loss as to how to pull the rowstatus property so I
    will know which rows need insertion, etc.
    Thanks for any help you may can provide!!!!!

    Thanks man
    Frank Xu Lei--谦卑若愚,好学若饥
    [老徐的网站]:http://www.frankxulei.com/
    [老徐的博客]:http://54peixun.com/Author/frankxulei
    微软WCF中文技术论坛
    微软WCF英文技术论坛
    微软WCF技术群:166599314

  • Comparing columns within cfgrid

    I have 2 queries that populate a third query using cfloop and
    querynew. The third query, "table1", works just fine. But I am
    using a java format cfgrid to output "table1". I want to highlight,
    change color, or something, when the value in one column's row does
    not match another column's row. Is that possible? How?

    Here's my code:
    <cfquery name="qrytl2000" datasource="libl">
    SELECT #choose2# FROM tldb70.drmst WHERE dracpy = 05 AND
    drasts IN (#preservesinglequotes(status2)#) AND (DRASID = '100' OR
    DRASID = '300')
    AND dradsp IN (99981,99982,99991,99992,99993,99994)
    </cfquery>
    <cfset table1 =
    querynew("tl2000drivercode,tl2000drivername,tl2000fleet,tl2000status,sqldrivercode,sqldri vername,sqlfleet,sqlstatus","varchar,varchar,integer,varchar,varchar,varchar,integer,varch ar")>
    <cfloop query="qrytl2000">
    <cfset addrow = queryaddrow(table1,1)>
    <cfset driverset =
    querysetcell(table1,"tl2000drivercode",qrytl2000.dradrv)>
    <cfset nameset =
    querysetcell(table1,"tl2000drivername",qrytl2000.dranam)>
    <cfquery name="qrysql" datasource="timeoff">
    SELECT #choose# FROM dbo.log_status WHERE drivercode =
    '#trim(qrytl2000.dradrv)#'
    </cfquery>
    <cfset driverset2 =
    querysetcell(table1,"sqldrivercode",qrysql.drivercode)>
    <cfset nameset2 =
    querysetcell(table1,"sqldrivername",qrysql.drivername)>
    <!---This section is for the Fleet number from TL2000.
    JP--->
    <cfif isDefined("qrytl2000.dradsp") AND
    #qrytl2000.dradsp# NEQ "">
    <cfset fleetset =
    querysetcell(table1,"tl2000fleet",qrytl2000.dradsp)>
    <cfset fleetset2 =
    querysetcell(table1,"sqlfleet",qrysql.fleet)>
    <cfelse>
    <cfset fleetset =
    querysetcell(table1,"tl2000fleet","")>
    <cfset fleetset2 = querysetcell(table1,"sqlfleet","")>
    </cfif>
    <!---This section is for the Driving Status from TL2000.
    JP--->
    <cfif isDefined("qrytl2000.drasts") AND
    #qrytl2000.drasts# NEQ "">
    <cfset statusset =
    querysetcell(table1,"tl2000status",qrytl2000.drasts)>
    <cfset statusset2 =
    querysetcell(table1,"sqlstatus",qrysql.drivingstatus)>
    <cfelse>
    <cfset statusset =
    querysetcell(table1,"tl2000status","")>
    <cfset statusset2 =
    querysetcell(table1,"sqlstatus","")>
    </cfif>
    </cfloop>
    <cfformgroup type="horizontal">
    <cfgrid name="details" query="table1" format="applet"
    colheaderbold="yes" colheaderalign="center" rowheaders="no"
    griddataalign="center" height="650" width="1200">
    <cfif #table1.sqlstatus# NEQ #table1.tl2000status#>
    <cfgridcolumn header="TL2000 PTO Code"
    name="tl2000drivercode" bgcolor="##FF3333" dataalign="left"
    width="120">
    <cfgridcolumn header="Database PTO Code"
    name="sqldrivercode" bgcolor="##FF3333" dataalign="left"
    width="140">
    <cfif isDefined("URL.drivername") AND #URL.drivername# EQ
    "drivername">
    <cfgridcolumn header="TL2000 PTO Name"
    name="tl2000drivername" bgcolor="##FF3333" dataalign="left"
    width="200">
    <cfgridcolumn header="Database PTO Name"
    name="sqldrivername" bgcolor="##FF3333" dataalign="left"
    width="200">
    </cfif>
    <cfif isDefined("URL.fleet") AND #URL.fleet# EQ
    "fleet">
    <cfgridcolumn header="TL2000 Fleet" name="tl2000fleet"
    bgcolor="##FF3333" width="100">
    <cfgridcolumn header="Database Fleet" name="sqlfleet"
    bgcolor="##FF3333" width="100">
    </cfif>
    <cfif isDefined("URL.status") AND #URL.status# EQ
    "status">
    <cfgridcolumn header="TL2000 PTO Status"
    name="tl2000status" bgcolor="##FF3333" width="140">
    <cfgridcolumn header="Database PTO Status"
    name="sqlstatus" bgcolor="##FF3333" width="140">
    </cfif>
    <cfelse>
    <cfgridcolumn header="TL2000 PTO Code"
    name="tl2000drivercode" dataalign="left" width="120">
    <cfgridcolumn header="Database PTO Code"
    name="sqldrivercode" dataalign="left" width="140">
    <cfif isDefined("URL.drivername") AND #URL.drivername# EQ
    "drivername">
    <cfgridcolumn header="TL2000 PTO Name"
    name="tl2000drivername" dataalign="left" width="200">
    <cfgridcolumn header="Database PTO Name"
    name="sqldrivername" dataalign="left" width="200">
    </cfif>
    <cfif isDefined("URL.fleet") AND #URL.fleet# EQ
    "fleet">
    <cfgridcolumn header="TL2000 Fleet" name="tl2000fleet"
    width="100">
    <cfgridcolumn header="Database Fleet" name="sqlfleet"
    width="100">
    </cfif>
    <cfif isDefined("URL.status") AND #URL.status# EQ
    "status">
    <cfgridcolumn header="TL2000 PTO Status"
    name="tl2000status" width="140">
    <cfgridcolumn header="Database PTO Status"
    name="sqlstatus" width="140">
    </cfif>
    </cfif>
    </cfgrid>
    </cfformgroup>
    How can I compare the individual rows of data between the
    columns; ie, tl2000drivercode compared with sqldrivercode to see if
    they match or not?

  • Comparing rows within cfgrid

    I have 2 queries that populate a third query using cfloop and
    querynew. The third query, "table1", works just fine. But I am
    using a java format cfgrid to output "table1". I want to highlight,
    change color, or something, when the value in one column's row does
    not match another column's row. Is that possible? How?

    I have 2 queries that populate a third query using cfloop and
    querynew. The third query, "table1", works just fine. But I am
    using a java format cfgrid to output "table1". I want to highlight,
    change color, or something, when the value in one column's row does
    not match another column's row. Is that possible? How?

  • Problem with cfgrid

    I have a sql statement that returns approximately 300 records back. I add these to the cfgrid and then i add two extra columns for a delete button and edit button... However since it takes quite sometime to loop through it to add the buttons because it loops 300times once and 300times again, the grid on the webpage takes alot of time to load and sometimes crashes and closes the browser. I know for a fact it is the extra columns because i took them out and just ran the sql statement and there is no problem. The problem is that the paging takes a very long time when the grid does not crash and becomes unusable.  Does anyknow how i can modify my code? thanks
    Here is my code: The first piece is a function that gets called
    <cffunction name="getRecords" access="remote" returntype="struct">
        <cfargument name="page" required="true" />
        <cfargument name="pageSize" required="true" />
        <cfargument name="gridsortcolumn" required="true" />
        <cfargument name="gridsortdirection" required="true" />
        <cfif arguments.gridsortcolumn eq "">
                <cfset arguments.gridsortcolumn = "title" />
                <cfset arguments.gridsortdirection = "asc" />
        </cfif>
        <cfquery name="records" datasource="geospatial">
                select resourceid,title,publicationdate
                from tbl_records
                order by #arguments.gridsortcolumn# #arguments.gridsortdirection#
        </cfquery>
          <cfset queryAddColumn(records, "delete", arrayNew(1))>
          <cfset queryAddColumn(records, "edit", arrayNew(1))>
          <cfloop query="records">
                <cfset querySetCell(records, "delete","<input value='Delete' type='button' onclick='javascript:del(#resourceid#)'>",currentrow)>
                <cfset querySetCell(records, "edit","<input value='Edit' type='button' onclick='javascript:edit(#resourceid#)'>",currentrow)>
            </cfloop>
        <cfreturn queryconvertforgrid(records, page, pagesize) />
    </cffunction>
    Here I call the function to load into the grid:
    <cfgrid format="html" name="userGrid" pagesize="20" selectmode="row"  bind="cfc:#Application.components#records.getRecords({cfgridpage},{cfgridpagesize},{cfgri dsortcolumn},{cfgridsortdirection})" gridlines="yes">
                                <cfgridcolumn name="title" width="180" header="Title" />
                                <cfgridcolumn name="publicationdate" width="180" header="Publication" />
                                <cfgridcolumn name="delete" width="150" header="Delete" />
                                <cfgridcolumn name="edit" width="166" header="Edit" />
    </cfgrid>

    I tried making the buttons links but the grid is still slow. It there a way to only retrieve a certain amount of records at a time instead of grabing all the records at once when the grid is doing paging? So each page returns like 20 records at a time and when u page u get another 20 records at a time and somehow bind it?.
    thanks

  • CFGRID (html) column a href issue

    Hello All,
    I am using the new cf8 html cfgrid. My Grid column is as
    follows:
    <cfgrid name = "NewReports" format="html" height="170"
    width="780" pageSize=5 sort=true>
    <cfgridcolumn width="160" name = "VIEWREPORT"
    header="Report" href="ViewReport.cfm?status=new"
    hrefkey="REP_REPORT_ID" target="_blank">
    </cfgrid>
    on the rows that do not have data (example if the query
    returns only 1 row.. there are 4 blank rows on the grid for page 1)
    the viewreports column shows a link. How do I go about not showing
    this link for blank rows? This was never an issue for flash grids,
    it seems that this is only appearing in html grids.
    Thanks
    Anusha
    Anusha

    it's not strange at all. your href is not inside a cfloop or
    cfoutput,
    so any reference to a query column will reference the first
    row only.
    one thing you can do is add a column that contains the full
    href text to
    your query, i.e.:
    SELECT categoryID, categoryName, CONCAT('/l/listing/tag/',
    categoryName,
    '.html') AS hreflink
    FROM...
    the above syntax is for MySQL, but your db will have its own
    CONCAT()
    function equivalent.
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Why is Cfgrid not working for me

    I am using CFMX7
    Why is this not working for me?
    This is Gridtest1.cfm
    <cfoutput>
    <CFFORM align="center" ACTION="gridtest2.cfm"
    METHOD="POST"
    name="getstuff" >
    <cfinput type="HIDDEN" name="ID" value="#form.id#" >
    <cfinput type="HIDDEN" name="customerno"
    value="#form.customerno#"
    >
    <cfgrid name="Mygrid" width="960" query="getpermits"
    gridlines =
    "yes" rowheaders="yes"
    selectmode = "edit" height="350" >
    <cfgridcolumn name="id" bgcolor="##FFFFFF" header="ID"
    display="yes" WIDTH="40" select="no">
    <cfgridcolumn name="permitno" bgcolor="##FFFFFF"
    header="Permit
    No" display="yes" width="70" select="yes">
    <cfgridcolumn name="sortorder" bgcolor="##FFFFFF"
    header="SortOrder" display="yes" WIDTH="62" select="yes">
    </cfgrid>
    <div align="center">
    <cfINPUT TYPE="submit" VALUE="Save My Changes"
    NAME="savemychanges"
    >
    </div>
    </cfform>
    </cfoutput>
    This is GridTest2.cfm
    Form fields:
    <cfoutput>[#form.fieldnames#]</cfoutput>
    Form values:
    <cfloop list="#form.fieldnames#"
    index="idx"><cfoutput>#idx# =
    #Evaluate(idx)#</cfoutput>
    </cfloop>
    <cfif isdefined ("form.savemychanges")>
    <cfgridupdate grid="mygrid" datasource = "divwt"
    tablename =
    "tankerpermits" keyonly="yes" >
    </cfif>
    <cfoutput>
    form.#__CFGRID__GETSTUFF__MYGRID#.original.#permitno#
    </cfoutput>
    Output from TestGrid2.cfm reflects a �funny
    looking� grid name and I
    can see in the output that Permitno is definitely a defined
    field.
    Form fields:
    [ID,CUSTOMERNO,SAVEMYCHANGES,__CFGRID__GETSTUFF__MYGRID]
    Form values:
    ID = 13
    CUSTOMERNO = 21691
    SAVEMYCHANGES = Save My Changes
    __CFGRID__GETSTUFF__MYGRID = __CFGRID__EDIT__=3 id N Permitno
    Y
    sortorder Y 1 U 571 z
    Element __CFGRID__GETSTUFF__MYGRID.ORIGINAL.PERMITNO is
    undefined in
    FORM.
    The error occurred in
    C:\cmudintranet\Purple\divwt\bftankertruck\gridtest2.cfm:
    line 147
    #form.__CFGRID__GETSTUFF__MYGRID.original.permitno#
    Thanks in Advance

    Lorna, be careful. This could cause your comments
    to stop working. Blog comments are
    sensitive..................
    .......... Lorna says ................................................
    Allyson, your precaution comes on the heels of me realizing that if I put a song on a blog summary page, then I will have to edit the .js file every time I add a blog entry.
    Whereas MassReplaceIt could solve the problem there, the added issue of problems with comments is enough to make me stay away, so that is what I will do: No music within 250' of the blog guy.
    Lorna in Southern California

  • CFGRID bind problem

    Hi, I have a problem with binding fields to a cfgrid.
    When I'm populating my grid using the query attribute the
    binding is not working. The problem is the accessing a row's cell;
    myGrid.selectedItem object exists but when I use
    myGrid.selectedItem.columnname nothing returns.
    Howerever when I use the same code and I populate the grid
    manually or via a loop in cfgridrow the code is working. (commented
    in code)
    Now the second option seems to be a solution but...
    when a db column is empty cf is not populating the column
    with an empty value but just takes the next data available from the
    list in the data attribute
    Anyone experienced this anoying problem before and could help
    me with a solution ?
    Thanks for your help!
    Here the code:
    [hi]
    <cfgrid query="query" name="myGrid" rowheaders="no"
    selectmode="row">
    <cfgridcolumn name="lname" header="Lastname" />
    <cfgridcolumn name="fname" header="Firstname" />
    <!--- <cfloop query="query">
    <cfgridrow data="#lname#,#fname#" />
    </cfloop> --->
    </cfgrid>
    <cfinput type="text" name="firstName" label="First Name:"
    bind="{myGrid.selectedItem.fname}" />
    [/hi]
    PS. forgot to mention that we're running on a CF 7.0.1

    This was a tricky one for me also, but it is a simple fix.
    When using a query, the myGrid.selecteItem.columnName is case
    sensitive, and it HAS to match the column name in your query SELECT
    statement.
    Look at the code below for an example.
    If you are using a SELECT * SQL statement, then your grid
    selectedItem column name HAS to match your DB spelling.
    <cfquery name="x"
    datasource="#application.datasource#">
    SELECT
    Orderid, CustomerID <!--- case of column names has to
    match your selectedItem column name --->
    FROM Orders
    </cfquery>
    <cfform name="y" format="flash">
    <cfgrid query="x" name="myGrid" rowheaders="no">
    <cfgridcolumn name="ORDERID" header="Order" /><!---
    notice all uppercase in name, matches --->
    <cfgridcolumn name="CUSTOMERID" header="Customer" />
    </cfgrid>
    <cfinput type="text" name="cID" label="Customer"
    bind="{myGrid.selectedItem.CustomerID}"/>
    <!--- notice the case matches SELECT statement
    Changing the case of any letter in the bind or in the select
    sql will cause your binding to not work.
    --->
    </cfform>

  • Cfgrid insert issue

    Hi,
    I am having a small issue with inserting new rows into a grid and is flaky about it, sometimes it works and sometimes it does not. Here is what appears to be happening(some of the time that is). Once the page is loaded and displaying the grid, I can press the insert button and it will expand the grid to show a blank row waiting for some data. I type the data in and hit submit and it processes the form and sends me back to grid, but does not show the new insert.
    It seems that once I type in the data I need to click off of the cell and bring the focus to something else and hit submit it does seem to work, but if I press the submit button while the new cell still has the cursor focus is when it seems to mostly fail.
    Any suggestions on what is exactly going on here or how to fix it? TIA.

    First page:
    <cfform action="editaffiliatetypeaction.cfm" method="post">
    <cfgrid name="editaffiliatetypegrid" selectmode="edit" insert="yes" insertbutton="Insert"delete="yes" deletebutton="Delete" query="getaffiliatetype">
    <cfgridcolumn name="affiliatetype_id" header="affiliatetype_ID" display="no">
    <cfgridcolumn name="affiliatetype" header="Affiliate Type" display="yes" width="255">
    </cfgrid><br />
    <cfinput type="submit" name="submit" value="submit">
    </cfform>
    Action page:
    <CFIF IsDefined("form.editaffiliatetypegrid.rowstatus.action")>
        <CFLOOP INDEX = "Counter" FROM = "1" TO =
            #ArrayLen(form.editaffiliatetypegrid.rowstatus.action)#>
        <CFOUTPUT>
        The row action for #Counter# is:
        #form.editaffiliatetypegrid.rowstatus.action[Counter]#
        <BR><BR>
        </CFOUTPUT>
        <CFIF form.editaffiliatetypegrid.rowstatus.action[Counter] IS "D">
        <CFQUERY NAME="DeleteAffiliatetype" DATASOURCE="#dsn#">
            DELETE from affiliatetype
            WHERE affiliatetype_id=#form.editaffiliatetypegrid.original.affiliatetype_id[Counter]#
        </CFQUERY>
    <CFELSEIF form.editaffiliatetypegrid.rowstatus.action[Counter] IS "U">
        <CFQUERY NAME="UpdateExistingAffiliatetype" DATASOURCE="#dsn#">
            UPDATE affiliatetype
            SET affiliatetype='#form.editaffiliatetypegrid.affiliatetype[Counter]#'
            WHERE affiliatetype_id=#form.editaffiliatetypegrid.original.affiliatetype_id[Counter]#
        </CFQUERY>
    <CFELSEIF form.editaffiliatetypegrid.rowstatus.action[Counter] IS "I">
        <CFQUERY NAME="InsertNewAffiliatetype" DATASOURCE="#dsn#">
            INSERT into affiliatetype
            (affiliatetype)
            VALUES ('#form.editaffiliatetypegrid.affiliatetype[Counter]#')
        </CFQUERY>
        </CFIF>
        </CFLOOP>
    </CFIF>
    <cflocation url="editaffiliatetype.cfm">

  • CFGRID Selected Item as Variable

    Is it possible to set the value of a selected item in a
    cfgrid to a variable?
    I have tried this but it does not work:
    <cfset UpdateID={recipegrid.selectedItem.RecipeID}>
    (Throws an error)
    also tried:
    <cfset UpdateID="{recipegrid.selectedItem.RecipeID}">
    (Just sets the variable to the string
    {recipegrid.selectedItem.RecipeID} not the actual value from the
    selected row.)
    or
    <cfset UpdateID='{recipegrid.selectedItem.RecipeID}'>
    (Does the same as above.)
    How can I do this?

    Your attempts don't work because they assign the Coldfusion
    variable
    UpdateID an Actionscript value
    {recipegrid.selectedItem.RecipeID}.
    Use cfinput's bind attribute. For example, the following code
    binds the Actionscript value {recipeGrid.selectedItem.recipeID} to
    the Coldfusion variable form.UpdateID when the form is submitted.
    <cfif isDefined("form.UpdateID")>
    UpdateID: <cfoutput>#form.UpdateID#</cfoutput>
    </cfif>
    <cfset recipes = "pasta,salad,meat">
    <cfset ids = "1,2,3">
    <cfform name="recipes" format="flash"
    action="#cgi.script_name#">
    <cfgrid name="recipeGrid">
    <cfgridcolumn name="recipeID" header="Recipe ID">
    <cfgridcolumn name="recipe" header="Recipe">
    <cfloop index="i" from="1" to="#ListLen(recipes)#">
    <cfgridrow data ="#ListGetAt(ids, i)#,#ListGetAt(recipes,
    i)#">
    </cfloop>
    </cfgrid>
    <cfinput name="UpdateID" type="text" label="Update ID"
    width="100" bind="{recipeGrid.selectedItem.recipeID}" />
    <cfinput name="sbmt" type="submit" value="Send">
    </cfform>

Maybe you are looking for