Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default checking for values

    hi. i'd like to perform a check on some values. these values are being
    populated into a structure that i'm then returning to flash. here's how it's
    currently set up: <cfscript> inventory[counter]['visits_total'] =
    visits_total; inventory[counter]['time_total'] = time_total;
    inventory[counter]['time_view_avg'] = time_view_avg; </cfscript> what i'm
    trying to do is check the visits_total. if that equals zero or if it returns
    some undefined value, then i'd like to populate it with a value of '0'.
    currently, it just returns an empty value. i tried this but it doesn't seem to
    be working. <cfscript> <cfif visits_total NEQ ''>
    inventory[counter]['visits_total'] = visits_total;
    inventory[counter]['time_total'] = time_total;
    inventory[counter]['time_view_avg'] = time_view_avg; <cfelse>
    inventory[counter]['time_total'] = time_total;
    inventory[counter]['visits_total'] = 0;
    inventory[counter]['time_view_avg'] = 0; </cfif> </cfscript> now
    when i run this, no values are being returned at all. can i put a conditional
    within cfscript tags? i'm not really sure where i'm going wrong as i'm
    relatively new to coldfusion and my knowledge is a bit scattered on the
    subject. any insight is greatly appreciated. best, fumeng.

    fu-meng Guest

  2. Similar Questions and Discussions

    1. read row values from datagrid and populate in new datagrid values from connected
      Hello, i am new in asp.net and i am having a question: I am having a datagrid_1 in which i am showing the context of PatientDetails table....
    2. Why don?t the location values in the Sprite Overlay agree with the values
      I would expect the left,top,right bottom values for a sprite that appear underneath it on the stage when you click on it to agree with the l,t,r,b...
    3. checking for values in MySQL and other conditions not working???
      I'm trying to redirect when testing for certain condidtions as shown below. When the conditions are ture, it redirects, but still goes ahead and...
    4. checking for values in a query
      I have a form that has a phone number field. Upon trying to leave the field I would like to run a piece of code that would check if the value...
    5. Adding custom values and database values to DropDwonList
      The other way is to create a DataTable, put the --None-- as the first Row, then read the datareader into the DataTable, and append the --other-- at...
  3. #2

    Default Re: checking for values

    You probably want something like this (remember, <cfscript> is a slightly
    different *dialect* than cfml.

    <cfscript>
    if (visits_total NEQ "") {
    inventory[counter]["visits_total"] = visits_total;
    inventory[counter]["time_total"] = time_total;
    inventory[counter]["time_view_avg"] = time_view_avg;
    } else {
    inventory[counter]["time_total"] = time_total;
    inventory[counter]["visits_total"] = 0;
    inventory[counter]["time_view_avg"] = 0;
    }
    </cfscript>

    <!--- OR --->

    <cfif (visits_total NEQ "")>
    <cfset inventory[counter]["visits_total"] = visits_total>
    <cfset inventory[counter]["time_total"] = time_total>
    <cfset inventory[counter]["time_view_avg"] = time_view_avg>
    <cfelse>
    <cfset inventory[counter]["time_total"] = time_total>
    <cfset inventory[counter]["visits_total"] = 0>
    <cfset inventory[counter]["time_view_avg"] = 0>
    </cfif>

    nTesla Guest

  4. #3

    Default Re: checking for values

    hello. thank you very much for responding to my post. i appreciate your help.
    i knew cfscript had a different syntax, ironically, it is one that i'm more
    used to coding in....and i still had to ask! but i got it now and understand
    why it works. so, thanks for your help. much appreciated -- fumeng.

    fu-meng Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139