Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default array and struct

    why went we push an array it get change to struct ?
    and why cannot loop on struct variable when the struct variable are number
    e.g main.1.input main.2.input

    alien3d Guest

  2. Similar Questions and Discussions

    1. Array element doesn't keep struct value?
      I'd like each of the following array elements to hold its own structure. <cfset TeamMemberDisplay = arraynew(1)> <cfset querystuct = structnew()>...
    2. Issues with declaring struct arrays inside of a struct
      I have the following C++ code: define MAXXPAXX 64 // Pack sub component of database struct. typedef PREFIX_PACKED struct { DWORD packid;...
    3. Calling fun taking struct and not pointer to struct?
      Robert Feldt wrote: I'm a little confused by the question... are you asking if: 1) The act of using a struct in the declaration of another...
    4. Fwd: Calling fun taking struct and not pointer to struct?
      Related to the recent thread about nested structs and Ruby/DL here is the answer from Ruby/DL's author: So that's what I ask you: Is inlining...
    5. "struct" vs. assoc. array
      Hi all, to handle a collection of data, I could use an associative array or a class. Provided I don't need any of the functionalities classes...
  3. #2

    Default Re: array and struct

    What do you mean when you push an Array????

    And you can loop through a struct if its reference is a number:-
    <cfoutput>
    <cfloop from="1" to="10" index="num">
    #main.input#
    </cfloop>
    </cfoutput>
    Stressed_Simon Guest

  4. #3

    Default Re: array and struct

    What i mean are like this
    <cfquery=xxxxx>
    anything[][][]=#table.user#
    </cfquery>
    Actually when we push or append and array it change to struct to prevent it i
    change the array to struct but when i want to loop it the struct the struct
    would not loop because it can't loop number as reference on would loop struct
    as word only e.g name_struct.1.x the number 1 couldn['t loop and it saz
    bla.......


    alien3d Guest

  5. #4

    Default Re: array and struct

    Here are the code
    <cfset kalendar=ArrayNew(2)>
    <cfset kalendar=structNew()>
    <cfset x=0>
    <cfinvoke
    component="cfm.Connections.database"
    method="getRecordset1"
    returnvariable="getRecordset1Ret">
    <cfinvokeargument name="user" value="#url.user#"/>
    <cfinvokeargument name="type" value="#url.type#"/>
    <cfinvokeargument name="dateReceived" value="#tarikh#"/>
    <cfinvokeargument name="dateReceivedTwo" value="#dateReceivedTwo#" />
    </cfinvoke>
    <!--- other language may define array starting from 0 but cold fusion are
    starting 1 weird --->
    <!--- major problem on array because it cannot loop counter inside query
    tag why why--->
    <!--- her more joke since array start from zero why waste to delete array
    number time again ? --->
    <cfoutput query="getRecordset1Ret">
    <cfloop index="i" from="0" to="23" >
    <cfif hour("#start_activity#") eq i>
    <cfset i=i+1>
    <!--- asumed 24 hour eq to midnight i equal to 24 hour and j are total
    array inside i hour --->
    <cfset x=x+1>
    <cfset kalendar.id="#id#">
    <cfset kalendar.user="#user#">
    <cfset kalendar.activity="#activity#">
    <cfset kalendar.event_type="#event_type#">
    <cfset kalendar.calendar_type="#calendar_type#">
    <cfset kalendar.start_activity="#start_activity#">
    <cfset kalendar.end_activity="#end_activity#">
    </cfif>
    </cfloop>
    </cfoutput>
    <cfinclude template="include/array_time.cfm">
    <!--- setting akan dibina --->
    <!--- actuall i want to make more loop to simplyfy the code but cannot
    since Cold
    fusion complain cannot translate complex object into simple variable form
    ?????
    Is there any bbcode tag for cfml ? Struct Find ? totally weird way to pull
    out output
    One activity per time only since cold fusion convert add value to array is
    struct do no why ???

    --->
    <cfloop index="i" from="1" to="24">
    <tr <cfif (i mod 2) eq 1>bgcolor="##b0b3cf"</cfif>>
    <td width="61">#masa[normal_clock]# </td>
    <td width="323" valign="top" align="left"><cfloop collection =
    #kalendar.activity# item = "value1">
    <cfif value1 eq i>
    #StructFind(kalendar.activity,value1)#
    </cfif>
    </cfloop>
    <br />
    <cfloop collection = #kalendar.user# item = "value">
    <cfif value eq i>
    <b>Di Hantar oleh : #StructFind(kalendar.user,value)#</b>
    </cfif>
    </cfloop></td>
    </tr>
    </cfloop>

    alien3d 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