Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7578143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:21:43+00:00 2026-05-30T17:21:43+00:00

I am looping through a query to create a list of part numbers to

  • 0

I am looping through a query to create a list of part numbers to populate a list of part numbers:

<cfset binlist = "" >
<cfset a = 1 />
    <cfloop query="getParts">
    <cfif a >
        <cfset binlist = getParts.binnum>
        <cfset a = 2 >
    <cfelse>
        <cfset binlist = binlist & "," & getParts.binnum >
    </cfif>
    </cfloop>

I want to add the binlist element to an element of an array in order to populate a spreadsheet:

<cfset aColumns = [ partnum,  shortchar08, partdescription, binlist, inventory.currinv , staged.stagedqty, alloc.allocqty, available, shelfCount, shipdtl.shipqty, getNumberofStores.numStores, tordered, APS, paddedLeadTime, LWM, storesRemain] />

<!---add the column data to the spreadsheet--->
<cfset SpreadsheetAddRow(SpreadsheetObj, ArrayToList(aColumns)) />

1 part can be in multiple bins. It works in my CF output page, but not in the spreadsheet that I am trying to generate to show the multiple bins for a part

The spreadsheet generated only contains one bin per part and not multiple bins for the parts that do have multiple bins.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T17:21:44+00:00Added an answer on May 30, 2026 at 5:21 pm

    I think (if I understand your logic) what you are attempting to do is simply one line of code in Coldfusion:

    <cfset binList = ValueList(getParts.binnum) />
    

    Upon looking at your code further, it looks like you are embedding a list into an Array, and then converting the array to a list. If you have a comma-separated list, then stick that in the middle of another comma-separated list, they’re going to just be interpreted as individual elements rather than a set.

    See what happens if you change your delimiter to something other than a comma so that it doesn’t get confused with the larger list:

    <cfset binList = ValueList(getParts.binnum, ';') />
    

    Update:

    OK, I see you have a part grouping problem. Let me update my solution:

    <!--- loop over unique parts -->
    <cfoutput query="getParts" group="partnum">
        <cfset binlist = "" > 
        <!--- loop over bin numbers for each part --->
        <cfoutput>
            <cfset binlist = ListAppend( binlist, getParts.binnum, ';' ) />
        </cfoutput>
        <!--- do row level stuff here --->
        <cfset aColumns = [ partnum,  shortchar08, partdescription, binlist, inventory.currinv , staged.stagedqty, alloc.allocqty, available, shelfCount, shipdtl.shipqty, getNumberofStores.numStores, tordered, APS, paddedLeadTime, LWM, storesRemain] />
    
        <!---add the column data to the spreadsheet--->
        <cfset SpreadsheetAddRow(SpreadsheetObj, ArrayToList(aColumns)) />
    
    </cfoutput>
    

    Basically, you don’t mix CFOUTPUT and CFLOOP. If you’re using CFOUTPUT to group, the inner CFOUTPUT is needed (minus the group parameter) to get your inner grouping.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been looping through the contents of a list in the simple fashion to
I am looping through a list for a spellchecker in vb.net (using vs 2010).
Is it possible to create a nested looping query in Access DB that will
I'm looking for a way to query the linux man pages through an API,
Looping through each id retrieve value of objects in 1 dimentional array and 2
While looping through a Dataset which code snippet should I use, should I go
When looping through a DataRow and encountering types such as DataRow dr; dr[someString] dr[someInteger]
Must be a way looping through this code: private void loadSprites() { this.sprites[0] =
I am looping through a large text file and im looking for lines that
I'm looping through an associative array with a foreach. I'd like to be able

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.