Testing for existance of a Structure within an Array
I have spent hours trying to write a function for error checking a csv file. In my function I want to check each field, and if there is an error put the errored text in a structure in an array, the array index will be relevant to the current row id of the query i am looping, and there will be a structure of the errors in each array element ( if that makes sense ) In total I have 24 fields of each row to check, hence me wanting to put the errors in an array so that I can provide an error report to the person uploading the csv file. I have no idea how to test for the existance of the structure for each item i want to test, i create the array first, then i will check each type of field, but i dont want to issue a if one is already created. ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185911 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Testing for existance of a Structure within an Array
but then .. if you are checking for a struct in a variable, what does that variable contain initially ? Micha Schopman Software Engineer Modern Media, Databankweg 12 M, 3821 AL Amersfoort Tel 033-4535377, Fax 033-4535388 KvK Amersfoort 39081679, Rabo 39.48.05.380 ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185912 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
Rather than putting the error structure into an array, why not use a structure? Then rather than having an array whuch is mostly empty you'll have a structure which only contains errors. so rather than errorsArray[rowNumber] = stError; you could do errorsStructure[rowNumber] = stError; does that makes sense? or did i misunderstand what you're doing? Cheers Bert On Thu, 02 Dec 2004 08:31:16 -0400, Brant Winter <[EMAIL PROTECTED]> wrote: ><<< if there is an error put the errored text in a structure in an array, the array index will be relevant to the current row id of the query i am looping, and there will be a structure of the errors in each array element ( if that makes sense ) > ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185913 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
The structure should initially be empty, or it may contain a value for anyone of 24 different errored fields. ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185914 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Testing for existance of a Structure within an Array
So, there is no real reason to check if one exists as it will always contain a struct ;-) -Original Message- From: Brant Winter [mailto:[EMAIL PROTECTED] Sent: 02 December 2004 12:55 To: CF-Talk Subject: Re: Testing for existance of a Structure within an Array The structure should initially be empty, or it may contain a value for anyone of 24 different errored fields. ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185915 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
well would you run into a problem with the array if you set each array index to the current row of your query loop. For example errorArray[1].etc errorArray[5].etc errorArray[22].etc I thought that when building and array you have to sequence your index values. If this is true you might need to create some other counter with in the loop for example *Increment the error Index *Now append the array* -- Original Message -- From: Brant Winter <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] Date: Thu, 02 Dec 2004 08:31:16 -0400 >I have spent hours trying to write a function for error checking a csv file. >In my function I want to check each field, and if there is an error put the >errored text in a structure in an array, the array index will be relevant to >the current row id of the query i am looping, and there will be a structure of >the errors in each array element ( if that makes sense ) > >In total I have 24 fields of each row to check, hence me wanting to put the >errors in an array so that I can provide an error report to the person >uploading the csv file. > >I have no idea how to test for the existance of the structure for each item i >want to test, i create the array first, then i will check each type of field, >but i dont want to issue a > if one is already created. > > > > > > > > > ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185916 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
>Rather than putting the error structure into an array, why not use a >structure? Then rather than having an array whuch is mostly empty >you'll have a structure which only contains errors. > >so rather than >errorsArray[rowNumber] = stError; >you could do >errorsStructure[rowNumber] = stError; > >does that makes sense? or did i misunderstand what you're doing? > >Cheers >Bert > >On Thu, 02 Dec 2004 08:31:16 -0400, Brant Winter <[EMAIL PROTECTED]> wrote: >><<< if there is an error put the errored text in a structure in >an array, the array index will be relevant to the current row id of >the query i am looping, and there will be a structure of the errors in >each array element ( if that makes sense ) >> Bert - I think that is I have 24 fields per row, if I have multiple errors per row they wont be able to be written as a group of errors if you know what i mean ? What I want is an array with the row number as the element number, and in that a structure that "may" have 24 elements in total. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185918 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
Then stAllMyErrors should contain a structure of any errors for each row which had an error, and nothing else. Yes? No? Bert On Thu, 02 Dec 2004 09:15:05 -0400, Brant Winter <[EMAIL PROTECTED]> wrote: <<<>>> > Bert - I think that is I have 24 fields per row, if I have multiple errors > per row they wont be able to be written as a group of errors if you know what > i mean ? What I want is an array with the row number as the element number, > and in that a structure that "may" have 24 elements in total. > > ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185920 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
The following code is pretty much doing what I need, but I am not sure how to call it from my code. Basically I read in a CSV file using the following line of code: ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185922 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
The following code is pretty much doing what I need, but I am not sure how to call it from my code. Basically I read in a CSV file using the following line of code: ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185923 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Testing for existance of a Structure within an Array
My example code is being truncated from this list somehow. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185925 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Testing for existance of a Structure within an Array
> My example code is being truncated from this list somehow. Prolly the hyphens... If you have -- (or a some other amount) in the code it cuts it. Make sure there isn't and the message isn't too long -- dc ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:185928 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54