문제

I am new bie on coldfusion, Please help me to get All ID, Name, Type Using CFLOOP?

enter image description here

<cfset categoryList = application.salesforce.queryObject("SELECT Id, Name FROM Category__c") />
<cfdump var="#categoryList#"> 
<cfloop list="#structKeyList(categoryList)#" index="key"> 
<cfdump var="#categoryList[key]#"> 
</cfloop>

The above Code give me the below result :
true
3
enter image description here

도움이 되었습니까?

해결책 3

Based on the updates that you have made to your question it looks like you might need to do something like this:

<cfoutput>
  <cfloop query="categoryList.results"> 
     <p>#id# - #name# - #type# </p>
  </cfloop>
</cfoutput>

Note that I have not tested this code

다른 팁

This is a pretty basic question you could have easily found my googling, but here you go anyway.

<cfoutput>
  <cfloop query="queryName">
    #queryName.ID#
    #queryName.name#
    #queryName.type#
  </cfloop>
</cfoutput>

Note you can replace cfloop with cfoutput and remove the cfoutput around everything.

I would just use a "cfoutput" tag...

<cfoutput query="yourquery">
   #yourquery.ID#
   #yourquery.name#
   #yourquery.type#
</cfoutput>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top