Name

StructUpdate

Synopsis

StructUpdate(structure, key, value)

Updates the specified key in structure by overwriting the existing data with value. The following example uses this function to update a key/value in a structure:

<CFSET Stock = StructNew(  )>
<CFSET Stock.Company = "Allaire">
<CFSET Stock.Ticker = "ALLR">
<CFSET Stock.Exchange = "NASDAQ">
<CFSET Stock.Price = "66.25">
<CFSET Stock.Change = "+0.375">
<CFSET Stock.LastTradeTime = "10:17AM">
<CFSET Stock.LastTradeDate = "05/17/1999">
<CFSET Stock.Volume = "8300">

<CFSET StructUpdate(Stock, "company", "Allaire Corp.")>

<CFOUTPUT>
<B>Company:</B> #Stock.company#<BR>
<B>Ticker:</B> #Stock.ticker#<BR>
<B>Exchange:</B> #Stock.exchange#<BR>
<B>Price:</B> #Stock.price#<BR>
<B>Change:</B> #Stock.change#<BR>
<B>Last Trade Time:</B> #Stock.lasttradetime#<BR>
<B>Last Trade Date:</B> #Stock.lasttradedate#<BR>
<B>Volume:</B> #Stock.volume#
</CFOUTPUT>

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.