Try to get the first sentence only - code does not

It makes me crazy - code works on a single page, but not on another, and I can't understand why. The code I use to get out of the first sentence of a field is as follows:

< cfset variables.firstsentence = Find (".", #get_spotlight.description #) >

< cfoutput query = "get_spotlight" >
< p > < #title # < br / >
#Left (description, variables.firstsentence) # (< a href = "database_spotlight.cfm? link_id = #link_id #" > learn more < /a >) < /p > < / cfoutput >

It works here: http://www.richland.lib.sc.us/research.cfm

I try to use the same code on another similar page, and the same code does not work. It takes only the first 40 characters or more and I don't know why. I guess it's something to do with the surrounding code, but I don't see what. Can someone enlighten us on that before go me crazy?
Here's the page I'm working on: http://www.richland.lib.sc.us/sample/linkstest6.cfm?subjecttype_id=16
And here's all the code (in case something else is causing the problem)

< cfquery name = "get_links()" datasource = "links_1", dbtype = "ODBC" >
SELECT links.link_id, links.title, links.link, links.description, links.url_home, links.icon, links.url_tutorial, links.discus,
Links.Subscription, subjecttype.subject_name, subject.link_id, subjecttype.subjecttype_id, subject.subjecttype_id
Links, subjecttype, subject
WHERE links.link_id = subject.link_id
AND subjecttype.subjecttype_id = subject.subjecttype_id
AND (subject.subjecttype_id = #url.subjecttype_id #)
ORDER BY title
< / cfquery >

< cfset variables.firstsentence = Find (".", #get_links.description #, 0) >

Output (with some HTML stranger deleted - sorry for the lengthy code - I'm sure there's probably a shorter, more elegant way to do..):

< cfoutput query = "get_links()" >
< cfif subscription IS "Yes" >
< cfif IS 'Home' icon >
< cfif url_home IS "" > <!-> the same in-house/remote url ".
< p > < img src = "" #icon #4.gif "alt ="database icon"width ="20"height ="20"align ="absmiddle"/ >"
< span class = "bold" > #TRIM (title) # </span > < cfif get_links.discus IS 'YES' >
"" < img src = "... / pictures/discus_logo.gif" alt = "DISCUS" width = "61" height = "17" align = "absmiddle" / > < / cfif > < br / >
#Left (description, variables.firstsentence) # < br / > < a href = "#link #" title = "#TRIM (title) #-inside the library" > inside the library < /a > |
< a href = "" #link # "title =" #TRIM (title) #-home access "> home access < /a >"
| < a href = "database_spotlight.cfm? link_id = #link_id #" > < img src = "moreinfo4.gif" alt = "More information" width = "20" height = "20" align = "absmiddle" / > < /a > "
< cfif url_tutorial IS NOT "" > | "."
"< a href ="... /... "/PDF/ #url_tutorial #" > < img src = "tutorial4.gif" alt = "Tutorial" width = "20" height = "20" align = "absmiddle" / > < /a > "
< / cfif > < / p >

< cfelse > <!--> two show internal URL / remote
< p > < img src = "" #icon #4.gif "alt ="database icon"width ="20"height ="20"align ="absmiddle"/ >"
< span class = "bold" > #TRIM (title) # </span > < cfif get_links.discus IS 'YES' >
"" < img src = "... / pictures/discus_logo.gif" alt = "DISCUS" width = "61" height = "17" align = "absmiddle" / > < / cfif > < br / >
#Left (description, variables.firstsentence) # < br / > < a href = "#link #" title = "#TRIM (title) #-inside the library" > inside the library < /a > |
< a href = "" #url_home # "title =" #TRIM (title) #-home access "> home access < /a > |" < a href = "database_spotlight.cfm? link_id = #link_id #" > < img src = "moreinfo4.gif" alt = "More information" width = "20" height = "20" align = "absmiddle" / > < /a > "

< cfif url_tutorial IS NOT "" > | "."
"< a href ="... /... "/PDF/ #url_tutorial #" > < img src = "tutorial4.gif" alt = "Tutorial" width = "20" height = "20" align = "absmiddle" / > < /a > "
< / cfif >
< /p >
< / cfif >
< cfelseif icon is "inhouse" > <!--see the internal url-->
< p > < img src = "" #icon #4.gif "alt ="icon of the database"align ="absmiddle"/ >"
< span class = "bold" > #TRIM (title) # </span > < br / >
#Left (description, variables.firstsentence) # < br / > < a href = "#link #" title = "#TRIM (title) #-inside the library" > inside the library < /a > | < a href = "database_spotlight.cfm? link_id = #link_id #" > < img src = "moreinfo4.gif" alt = "More information" width = "20" height = "20" align = "absmiddle" / > < /a > "

< cfif url_tutorial IS NOT "" > | "."
"< a href ="... /... "/PDF/ #url_tutorial #" > < img src = "tutorial4.gif" alt = "Tutorial" width = "20" height = "20" align = "absmiddle" / > < /a > "
< / cfif > < / p >
< / cfif >
< / cfif >
< / cfoutput >
< p > < / p >
< h3 > librarian - selection of Web Sites < / h3 >
< cfoutput query = "get_links()" > <! - no subscription sites - >
< cfif subscription IS 'No' >
< p > < img src = "" #icon #4.gif "alt ="icon of the database"align ="absmiddle"/ >"
< a href = "" #link # "title =" #TRIM (title) #"> #TRIM (title) # < /a > < br / >"
#Left (description, variables.firstsentence) # < br / >
< a href = "database_spotlight.cfm? link_id = #link_id #" > < img src = "moreinfo4.gif" alt = "More information" width = "20" height = "20" align = "absmiddle" / > < /a > < /p > "
< / cfif >
< / cfoutput >

Thank you for reading this day and for any help or suggestion.

YES! That's all--woohoo! Thank you very much. In addition, this explains why the same piece of code works on another page - this page I only shot one record instead of many. I looked up the ListFirst function and I understand that - but I never would have thought it myself.

Thank you very much for coming up with the answer - and thanks to everyone who took the time to try it - I really appreciate it.

Quote:
Posted by: Swift
Hi Michelle,

If I'm right, then it is a simple problem. The simplest are good. :)

That's what you have:


<>

#Left (description, variables.firstsentence) # (read more...)

What you have done is in the position of the period off the first record in the data base by base and then applied to all records in the database. So you're cutting posted on 40 every time, because you will find that the first record in the database should be cut to the 40 position. Instead, you simply calculate the position each time inside the loop. In addition, we will just go ahead and make it even easier by using ListFirst...


<>

#ListFirst (description, ".") # (read more...)

That should do it. By the way, if you really want the period appear (which I imagine you do), then just use:

#ListFirst (description, ".") #.

Instead of

#ListFirst (description, ".") #.

HTH,
SWIFT

Tags: ColdFusion

Similar Questions

  • Windows PC upgrade to 10. Try to install the first Pro CS5. Does not work.

    Windows PC upgrade to 10. Try to install the first Pro CS5. Does not work.

    Download the following messages: Exit Code: 7 please see the faults and warnings below for troubleshooting. For example, ERROR: DW050... WARNING: DW036, DW066...

    -0 fatal Error (s), 82 (s), 124 warning (s)

    Any idea?

    Thank you

    Jaap

    Do you have other Adobe applications installed on your computer?

    Navigate to C: > Program Files > Adobe.

    Open the Adobe folder and check if the Adobe Premiere pro CS5 folder is created with files stay inside?

    Let us know.

    As System File Checker run command once and see if \any system files are corrupt. As you had upgraded to Windows 10 we will check the system files once. Later we can try to provide full permissions for the required records.

    https://support.Microsoft.com/en-in/KB/929833

  • Try to get the JSX execution path ($.filePath does not)

    I'm trying to get the location of the directory of the current script (main.jsx of my Panel).
    I tried to use $.filePath without success...

    Alert($.) FilePath);
    Returns undefined or int

    var thisFile = new File($.fileName);
    Alert (thisFile);

    Returns /c/Program%20Files/Adobe/Adobe%20Photoshop%20CC%202015

    var thisFile = new File($.fileName).parent;

    alert (thisFile .fsName);

    Returns C:\Program Files\Adobe\Adobe Photoshop CC 2015

    What I am doing wrong?
    I need to get the path of the currently executing script file if I do .parent for its folder name and obtaining an apparent folder name where I have a few things to recover. I run this in my main.jsx - file.

    Found the solution!

    By running this code in the javascript of your extension file, you will get the path:

    var csInterface = new CSInterface();
    var extensionRoot = csInterface.getSystemPath(SystemPath.EXTENSION) + "/jsx/";
    alert(extensionRoot);
    

    Credits goes to Barranca of Davide

  • I have subscription for adobe cc and when I try to get the first he comes up with an unusable version of first cs6 for some reason, I can't change it, please help me

    I have subscription for adobe cc and when I try to get the first he comes up with an unusable version of first cs6 for some reason, I can't change it, please help me

    Your system meets the criteria for more recent versions of first?

    Premiere Pro - http://helpx.adobe.com/premiere-pro/system-requirements.html

  • Get the error 'windows wireless service does not work on this computer' diagnose in Wireless adapt

    Get the error 'windows wireless service does not work on this computer' diagnose in Wireless adapt. The same is not solved.

    I'm unable to locate networks wireless on my Windows 7 PC. Help, please.

    Try to uninstall/reinstall the drivers for your wireless network. You should be able to get them from from Toshiba Web site.

    I hope this helps.

  • I try to install the progrsm Fixit and it does not allow me to make the race he leaves on the download

    original title: installation FIXIT

    I try to install the progrsm Fixit and it does not allow me to make the race he leaves on the download?

    Hello

    1. What operating system do you work?
    2. What Fix - it you are trying to install?
    3. What version of internet explore do you use?

    Please refer to the below link mentioned before asking your question so that you can provide all the relevant information for us to help you:

    http://support.Microsoft.com/kb/555375

    You can try the following:

    Remove temporary internet files

    http://Windows.Microsoft.com/en-us/Windows7/delete-files-using-disk-cleanup

    Also try to save the file on your computer, then run it.

  • I get the message my redemption code is not valid.

    I enter the serial number to install the adobe photoshop elements 13 I bought. I have the redemption code. When I get home to get the serial number, I get the message that it is not valid. I entered exactly as it is written with capital letters and numbers. There is no cat in line... very frustrating

    I did - I made a mistake very pop: I was before the letter "O", instead of "0" the number... now it's all solved!

  • Try to run Defrag/Task Scheduler Service, get the message 'Task Scheduler Service does not work' in Windows 7

    I'm trying to defragment my system (Windows 7).  When I go to START and type in "Defragmenter" it states: "the Task Scheduler Service does not work.  "Start the Task Scheduler Service and try again.  When I do, the following message appears: "the remote computer is not found.  Please tell us what to do next.  Thank you.

    Task Scheduler, Windows event log, and the RPC end Point Mapper are included to start automatically?

    Click on the Start button and select Control Panel, administrative tools, Services. Locate the Windows event log in the list. Check that he started and that the startup type is automatic. If it is not set to automatic, right-click and select Properties, general tab. There is a box after the startup type. The options are available in a menu drop-down by clicking on the down arrow to the right of the box. Make the change and click apply and then click OK. Restart the computer and verify if it has started.

  • Go to the first tab Alt - 1 does not

    For Firefox in Kubuntu 15.04 40. (installed costs) to go to the first tab with Alt-1 behavior no longer works.
    He has worked in previous versions of Firefox.

    This problem only happens "Alt - 1', Alt-2 and thus now work as expected."

    I guess the Linux operating system has supported the shortcut Alt + 1, and it is not Firefox.

  • Dynamic links between the first Pro and AE does not

    I had this problem where dynamic link is grayed out in the menu of Premiere Pro, when I try to link a clip to AE. It's the same thing the opposite (i.e. of the AE at first), and also "replace it with after effects Comp" is grayed out as well. I'm using the CC (not CC 2014) version, so it should work?

    Thanks for your help!

    These versions are compatible.  I would expect it to work.

    Try to update the latest versions for all programs.

  • Tracking of movement on the first 10 elements mode does not work.

    I am trying to attach the words of a moving object in first 10 elements. I already follow an object and has an orange box around him that travels with the object. Now I want to join him the words, but when I drag a title on the box, nothing happens. I managed once before with this, and it seems that you need to get the box orange to be blue by clicking on it in a certain way. However, I was not able to get this box to be blue, so I can't join him words.

    Thank you!

    As I said, this feature may or may not work with these images.

  • Dynamic action in the exectute pl/sql code does not.

    Hi all.
    I have a text box on my P5_test page and a test_data of table with one field testData (varchar20) and a button on my page save_data.
    I modified the model button to add #BUTTON_ATTRIBUTES # and then I placed in the attributes of the button save_data
     id="test_button" 
                        in action when clicked : Redirect to URL
                                                URL:  javascript:return;
               
    I then created a dynamic action to run when the save_data is clicked and it runs after the pl/sql code
                   begin
                           insert into test_data (testdata) values (:P5_TEST);
                   end;
                  and in the 'Page items to Submit' box i entered P5_TEST
          
    NOW. the problem is, whenever I click on the save_data button, it add a new record in the table of test_data but a vacuum! I mean the value I get P5_test evaporates! I mean why the value on the form as I entered do not go to table?

    waiting desperately for help.
    million thanks in advance.

    Hello

    I think that everything is perfect, except for one thing...

    go to edit-> edit condition true dynamic action

    you will find the 'Page Elements to submit' enter 'P5_TEST '.

    It will work

    Thank you
    Abdou Bosamiya
    + 91 76000 23053
    http://jbosamiya.blogspot.com

  • When stopping down to the EXP get the message "rundll.exe program does not ' and computer does not turn off. How should I do?

    Can't stop it to exit the mode and get the data message may not be saved.

    Hello

    Windows operating system you are using?

    Step 1: You can check if the same problem occurs in safe mode with network.

    Please follow the link on how to start the computer in safe mode with network below.

    http://Windows.Microsoft.com/en-us/Windows7/start-your-computer-in-safe-mode

    Step 2: Clean boot

    How to set up Windows 7 to start in a "clean boot" State

    http://support.Microsoft.com/kb/929135

    Note: After a repair, be sure to set the computer to start as usual as mentioned in step 7 in the above article.

    For reference:

    What version of the operating system Windows am I running?

    http://Windows.Microsoft.com/en-us/Windows7/help/which-version-of-the-Windows-operating-system-am-i-running

    Let us know if that helps.

  • my computer told me to repair windows.and everytime I try I get a blue screen. It does not start in any mode without failure. I just get a blue screen. Thany you shane

    whenever I try to start my computer .a blue screen come often does not start in any of the modes security .He told me to repair windows recommended. can't do recovery or what he can be.wont start in safety mode.what can I do .thank you. Leonard.

    Hi leonardhurley,

    Since when are you facing this problem?

    You did changes before this problem occurs?

    What is the exact blue screen error message you received?

    Method 1

    I suggest that you perform the last good known Configuration

    http://Windows.Microsoft.com/en-us/Windows-Vista/using-last-known-good-configuration

    Method 2: disable automatic reboot in order to collect the Blue error screen, so in case the blue screen just flashes and dries on.

    Method 3:

    I suggest you to follow the article below for the Blue error screen.

    http://support.Microsoft.com/kb/958233/en-us

  • LR 30 day trial bought the educational version &amp; activation code does not

    Hello

    I bought an iMac 5K and used the opening on my old machine. Thought it was a good time to upgrade to 5 LR.

    The 30-day trial and decided yes I was very happy has downloaded the software. I bought the educational version and received my code by email. This code is not being accepted by LR 5.7.1.

    The downloadable version is different from the one I have purchased?

    I have to remove the version I have installed and then use the disk? If this is the case can I reload my past 2 weeks going to LR?

    Thanks a lot for your help.

    Your catalog should open automatically. No need to start over.

Maybe you are looking for

  • Firefox will not allow certain sites to open popups of viewers or login.

    OS: Windows 8.1 (64-bit) x 64 CPU AMD E-300 Firefox 25.0.1 I just got a new laptop and found this question: when I try to click on the links on some sites to open a lightbox or popup (usually for slideshows or connection boxes) nothing happens. Absol

  • Tower system what old Apple back and and money buy a new one?

    Hello. I have an iPad 2, I bought it 3 years ago and I also have an iPod 5 Tough (iOS 8) I did not use those a lot, so those are work, good and outside look good either broken. I want to buy a new iPad, so I have these two back and add money to buy a

  • Safari on Mac El Capitan accidents

    Hi, recently updated to El Capitan and installed all updates including safari.  Safari then began to plant start up. Have followed the instructions found on the Internet (via the iPad) to remove all extensions, cache, plug-ins etc etc.  Can now open

  • Any chance that it will be safe to install?

    http://support.Microsoft.com/kb/976038  Hello, I use a program called Unity that I use to make indie games on Vista (I know, I know, I have Win 7). The Unit recommended I have install this hotfix. I'm fine with that, but it is not fully tested. Micro

  • connection of CD players problems

    I am running XP.  Recently, I ran into a problem where my CD players do not connect.  When I go into Device Manager, I see that there are yellow "attention triangles ' on device names.  This applies to both drives I have installed.  I also tried to a