donboe — 2011-10-13T11:09:56-04:00 — #1
I need to divide the content from one field in my database(6 paragraphs) in two equal parts of three paragraphs. What would be the best way to that? I thought it was possible in my query but it seems not. Any advise would be more than welcome.
r937 — 2011-10-13T11:36:28-04:00 — #2
it ~is~ possible in the query, but you looked like you were about to run two separate queries, one for the first 3 paragraphs, and another for the rest
and that's wasteful
grab everything in one query, then break it up with coldfusion
in your other thread, you were using CHAR(13,10) as the paragraph marker, so i would try that with ListGetAt
<p>#ListGetAt(queryname.content,1,CHAR(13,10),FALSE#</p> <!--- 1st paragraph --->
<p>#ListGetAt(queryname.content,2,CHAR(13,10),FALSE#</p> <!--- 2nd paragraph --->
<p>#ListGetAt(queryname.content,3,CHAR(13,10),FALSE#</p> <!--- 3rd paragraph --->
<p> ... other content ... </p>
<p>#ListGetAt(queryname.content,4,CHAR(13,10),FALSE#</p> <!--- 4th paragraph --->
<!--- etc. --->
donboe — 2011-10-14T06:43:20-04:00 — #3
Hi Rudy, thank you for the responce. It looks like a good structure I only get the following error:
Invalid CFML construct found on line 14 at column 59.
ColdFusion was looking at the following text:
14 : <p>#ListGetAt(getContent.content,1,CHAR(13,10),FALSE#</p>
15 : <p>#ListGetAt(getContent.content,2,CHAR(13,10),FALSE#</p>
16 : <p>#ListGetAt(getContent.content,3,CHAR(13,10),FALSE#</p>
What could be the reason?
r937 — 2011-10-14T07:58:33-04:00 — #4
looks like someone forgot the parentheses to close the function
donboe — 2011-10-14T08:10:27-04:00 — #5
Stupid, stupid, stupid, that I didn't see that Now on the other hand I get the error that Variable CHAR is undefined. ?
Sorry for my ignorance, but so far I never had to deal with something like this.
Thank you in advance.
r937 — 2011-10-14T08:40:18-04:00 — #6
you are learning rather quickly that i didn't test my code, eh
(i have an excuse: my computer died last month, i had to buy a new one, and i still haven't gotten around to installing coldfusion again -- i absolutely ~hate~ installs, last time i spent days, literally days, trying to get the damned thing working, declaring the datasource or whatever you have to do to get it to talk to mysql... i am looking forward to that experience again just like you would look forward to having a root canal)
anyhow, replace CHAR(13,10) with CHR(13)&CHR(10)
donboe — 2011-10-14T10:41:06-04:00 — #7
Hi Rudy this seems to work indeed. Great stuff. I have one last question though. I try to understand the CHR(13)&CHR(10) since within my content I have some lists as well. I though by sticking those in a paragraph I could output them as well but that doesn't seem to work? What should I do to count a list next to the paragraphs?
(i have an excuse: my computer died last month, i had to buy a new one, and i still haven't gotten around to installing coldfusion again -- i absolutely ~hate~ installs, last time i spent days, literally days, trying to get the damned thing working)
I know the feeling. I had the same thing last month. What a disaster. You loose so much time
r937 — 2011-10-14T11:22:24-04:00 — #8
i have no idea what your content actually looks like, aside from the fact that i know you're using carriage return and line feed to delimit your paragraphs
if your content is more complicated than that, i'm sorry, i think that would be a new thread
donboe — 2011-10-14T13:57:27-04:00 — #9
Thank you Rudy. I will give this some more thought, before I come back to this. Anyway thank you again.