A LEFT function?

I have a spry data set that has a field postComment that can
be quite long. I can use {postComment} to show the whole thing.
Is there anything that would allow me to do something like
showing the first 50 characters or such? Would be like a teaser.
Looked over docs quickly and forum, but didn't see anything
like this.
Appreciate any help.
Thanks!
Keith

Hi Keith,
You can use an onPostLoad() handler to create a "teaser"
column for your data set.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="
http://www.w3.org/1999/xhtml"
xmlns:spry="
http://ns.adobe.com/spry">
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8" />
<script src="SpryAssets/xpath.js"
type="text/javascript"></script>
<script src="SpryAssets/SpryData.js"
type="text/javascript"></script>
<script type="text/javascript">
<!--
var ds1 = new Spry.Data.XMLDataSet("products.xml",
"/products/product");
ds1.addObserver(addTeaserColumn);
function addTeaserColumn(notificationType, notifier, data)
if (notificationType != "onPostLoad")
return;
// Get the unfiltered set of rows from the data set.
var rows = notifier.getData(true);
var numRows = rows.length;
// Now loop over every row generate a teaser column.
for (var i = 0; i < numRows; i++)
// Check the length of the entity decoded version of the
desc column,
// because we don't want to factor in the length of entity
encoded
// character names in our length check.
var row = rows[ i ];
var desc = row[ "desc" ];
var decodedDesc = Spry.Utils.decodeEntities(desc);
if (decodedDesc.length > 50)
row[ "teaser" ] =
Spry.Utils.encodeEntities(decodedDesc.substring(0, 47) + "...");
else
row[ "teaser" ] = desc;
//-->
</script>
</head>
<body>
<div spry:region="ds1">
<pre spry:repeatchildren="ds1">{teaser}
</pre>
</div>
</body>
</html>
--== Kin ==--

Similar Messages

  • SQL Max and Left functions

    In a table I have a field "Ticket No.". I am using Ticket No in a format like:
    00021-10-06-0201
    The first set (left side) represents Ticket No. Then month, year, and code.
    Each time when a user wants to enter new record a new ID is generated as:
    "Select max(Left(TicketID,5)) from Ticket".
    The new id becomes result+1.
    I want to know that the above field is a string. But when I use LEFT
    function, as above, it successfully returns max of the first set. Does
    it automatically converts it to Long integer?
    If not, how to use it securely so that first the left set is converted
    to Long Integer and then the MAX is found. All in SQL query.

    I want to know whether your "substr(00021...)
    approach and in my example, does max function
    automatically converts it to a numeric type.I did not use MAX in my example, but still it is converting to numeric depending on the operator you are using. Elaborating....see below..
    SQL> select substr('00021-10-06-0021',1,5)+1 from dual;
    SUBSTR('00021-10-06-0021',1,5)+1
                                  22
    SQL> select substr('A0021-10-06-0021',1,5)+1 from dual;
    select substr('A0021-10-06-0021',1,5)+1 from dual
    ERROR at line 1:
    ORA-01722: invalid number
    SQL> select substr('A0021-10-06-0021',1,5)||'A' from dual;
    SUBSTR
    A0021ASee the above 1st and 3rd query, the behaviour is completely based on the operators.

  • HT3296 progress bar for left function will not fill entirely

    when using the learn remote feature everything seems to be working fine, except that the left function refuses to fill in the porgress bar, it goes about a fifith of the way and stops. NO error messages just stops. Ideas?

    Here's a good discussion: http://www.gotoandlearnforum.com/viewtopic.php?f=29&t=15581
    Look at the example code that's about 8 replies down.

  • In Query of Query, can't use LEFT() function?

    Hi All,
    I've got an LDAP query that I use for our employee directory. I then do a Query of Queries and do LEFT(SN,1) to separate out by first character of last name [A,B,C,D,E...] etc.
    I had this working just fine in Railo CFM, but now I'm using Adobe CF and can't get that to work. I'm on CF9 Standard.
    I've read the Query of Queries guide, but didn't find anything helpful there. Even when I do
    '#LEFT(SN,1)#' as FirstCharacterOfLastName in my query, what I get is the value for the last row, not the value of each row as it's looping through the recordset.
    Am I missing something? Any way to get that to work? Is that addressed in CF10?
    thx.Ben

    You need to understand two things:
    1) any CFML in your SQL string within a <cfquery> tag pair is processed by CF before the SQL string is passed to the DB driver.  So your #left()# expression won't be processed "per row", because it's processed before the DB engine does any "per row" operations.
    2) QoQ's SQL support is tragically minimalist.  This lists all the functions it supports:
    http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WSc3ff6d0ea77859461172e0811cbec0e4fd -7ff0.html#WSc3ff6d0ea77859461172e0811cbec0e4fd-7fcc
    With the addition of two string functions: UPPER() and LOWER().  Oh, and CAST() (if that can be seen as a function).
    That's it.  That page in the docs describes all the functionality QoQ has.  There's nothing missing 9as far as I know).  That's it.  There's not much to it.
    I've been lobbying Adobe for a number of years to pull finger and improve QoQ to the point that it's more than just a curio, but they don't seem interested.
    As to why your code works on Railo?  Railo does some weird things, and doesn't stick to the precedent Adobe dictates their language should follow.  Depending on who you talk to, this is either a feature or a barrier to entry (I'm mostly ambivalent, but err towards the latter camp).  But perhaps Railo's QoQ processor supports LEFT().
    Basically... you're gonna have to approach this differently: loop over the query with <cfloop> (etc) and update it row by row.  This is pretty much what QoQ is doing anyhow, so I don't think you'll see a performance degradation.  Well: you won't... because you can't do what you want to do with QoQ at all, I guess ;-)
    Adam

  • Urgent(Right and Left Functions)

    Hello All,
    In our requiremnet it was mentioned like one column like right(columnname,13) and left(right(columnname,11),10).Is they are any functions like left and right in SQL?I didn't find any of these functions in SQL.
    Are they are something like Substr functions?
    Pls help me out.

    user631532 wrote:
    I mean it is something like right(columnname,13) means substr(columnname,-13)
    left(columnname,13) means substr(columnname,13)
    left(right(columnname,11),10) means substr(columnname,-11,10)
    right(left(columnname,11),10) means substr(columnname,11,-10).
    Is my understanding is correct?
    If not pls rply me.You could have read the documentation and tried it yourself...
    right 13
      1* select substr('0123456789ABCDEFGHIJKLM',-13) from dual
    SQL> /
    SUBSTR('01234
    ABCDEFGHIJKLMleft 13
      1* select substr('0123456789ABCDEFGHIJKLM',1,13) from dual
    SQL> /
    SUBSTR('01234
    0123456789ABCleft(right 11)10
      1* select substr('0123456789ABCDEFGHIJKLM',-11,10) from dual
    SQL> /
    SUBSTR('01
    CDEFGHIJKLright(left 11)10
      1* select substr(substr('0123456789ABCDEFGHIJKLM',1,11),-10) from dual
    SQL> /
    SUBSTR(SUB
    123456789A

  • Use of LEFT, MID  functions in MS Access expression evaluating a SQL pass-thru on an Oracle Backend

    As the title above suggests this is a somewhat complex problem.
    I have the following expression on a field in a MS Access Make Table query.
    Left([SYN4_View Invalid Last Candidates]![LastName],3). The table it is referring to: SYN4_View Invalid Last Candidates is a SQL Pass-thru query on an Oracle backend. So, when the expression attempts to evaluate in MS Access 2003 I get the following error msg:
    Undefined function 'left' in expression.
    I am assuming this is because LEFT function can't evaluate the output of the SQL P-T. I can't use SUBSTR as Access doesn't recognize it.
    I would appreciate suggestions

    robleh7 wrote:
    I don't have access to the Oracle dB. No pun intended here. Everything I do, I must do from the MS Access 2003 front-end
    wow .. that's kinda like sending soldiers into a war zone with a bear trap attached to their legs. O_0
    Kind of blatantly trying to hamper your ability to do your job, don't you think?

  • CS3 JS progress bar function

    I'm trying to create a progress bar function but the code below creates 6 instances of the progress window rather than updating the info in the first window.  I've gone the for loop process to make progress bars work is this the only way it can be used or is there a way to tell if a window is open on if so update the bar and info of that window?
    to call the bar I use stagesLeft("Looking for duplicates",1)
    function stagesLeft(myText,stageVal){
        var myStop =6;
        var myPbValue = stageVal;
        var myWindow = new Window ( 'window',' Progress');
        var myProgressBar = myWindow.add ('progressbar', [12, 12, 350, 24], 0, myStop);
        var myStaticText = myWindow.add('statictext');
        myStaticText.bounds = [0, 0, 340, 20];
        myStaticText.alignment = "left";
            myWindow.show();
            myProgressBar.value = myPbValue;
            myStaticText.text = myText;
            myWindow.text = 'Stage '+ myPbValue + ' out of ' + myStop;
            if(myPbValue == 6){
            myWindow.close();

    Thanks Jongware I knew it had to be something simple.
    Working version:
        var myStop =6;
        var myWindow = new Window ( 'window','Progress');
        var myProgressBar = myWindow.add ('progressbar', [12, 12, 350, 24], 0, myStop);
        var myStaticText = myWindow.add('statictext');
        myStaticText.bounds = [0, 0, 340, 20];
        myStaticText.alignment = "left";
    function stagesLeft(myText,stageVal){
        if(stageVal == 1){   
            myWindow.show();
            myProgressBar.value = stageVal;
            myStaticText.text = myText;
            myWindow.text = 'Stage '+ stageVal + ' out of ' + myStop;
            if(stageVal == 6){
            myWindow.close();
    To use the function:
    stagesLeft("This is the first stage",1)
    then further on in the script when another process is taking place
    stagesLeft("Here is stage 2 of this script",2)
    etc etc.
    Cheers, John.

  • Substr function problem in oracle

    my requirement is that i am writing the stored procedure in which use
    *substr( source_string, start_position, [ length ] )*
    my 1 requirement
    i have i problem that the source_string is dynamically being passed as a parameter into the stored procedure
    means its length can vary
    and start_position is dynamically being passed as a parameter into the stored procedure should be that is should start from start of the sting and it can also vary
    my 2 requirement
    as in SQL Server we have left and Right function
    if we use left like this
    this is code from SQL Server
    note: in SQL Server left function Returns the left part of a character string with the specified number of characters.
    *@FinalCode = left(@TempCode,Len(@TempCode)-1)*
    *@FinalCode : this user declared local variable in stored procedure*
    *@TempCode:this is the dynamic string i am passing in stored procedure*
    when we use left it starts the reading string from left side
    note: in SQL Server right function Returns the right part of a character string with the specified number of characters.
    Set @FinalCode = Right(@FinalCode,len(@FinalCode)-1)
    when we use Right it starts the reading string from Right side
    my requirement is how to do this oracle as i am new to oracle 10g with the use of
    *substr( source_string, start_position, [ length ] )*
    Edited by: user21354 on Feb 8, 2011 4:06 AM

    when we use Right it starts the reading string from Right sideStart from left:
    SQL> select substr('abc', 1, 1) from dual;
    S
    aStart from right:
    SQL> select substr('abc', -1, 1) from dual;
    S
    c

  • Remap Left and Right Command Keys as Different Buttons?

    Hello,
    I'm suffering from the dreaded emacs pinky (yes, I've already changed the caps-lock key to ctrl) and I want to know if it is possible to set the left and right command keys to different options.
    For example, to keep the right command key as command, but have the left function as ctrl.
    Thanks for any help.

    I think the answer is the same as last year.  Don't know of any way to do that.
    Captfred

  • Fdm 11.1.2.1 mapping table scripts does not accept vba functions like 'lef

    ok, in fdm 11.1.2.1, in the UD2 column of IMPORTS, i have something like "award::purpose::type" , and in the mapping table script , i'm trying to use the 'left' and 'mid' functions to break down the UD2 columns (delimited by "::"), and then mapping it to a result in VALIDATE.
    why don't the simple VBA functions work in the mapping scripts (where you have "#Script" in the "Target Custom2 column")
    to keep things simple, i would like the following to work (and it errors on the first line at the 'left' function)
    One_Award = Left(varvalues(21), 5)
    Result = One_Award
    thanks.
    Edited by: 866191 on Jun 26, 2012 8:15 AM

    first, i changed my original message at the top; please take another look. thank you.
    the error message is:
    ** Begin FDM Runtime Error Log Entry [2012-06-26 08:26:57] **
    ERROR:
    Code............................................. 5
    Description...................................... Conditional Map Script Error: Invalid procedure call or argument: 'Left' at line(7)
    Procedure........................................ clsCalcEngine.fFlagWildcard
    Component........................................ upsWObjectsDM
    Version.......................................... 1112
    Thread........................................... 4492
    IDENTIFICATION:
    User............................................. bachoi
    Computer Name.................................... OFEPMAPPUAT05
    App Name......................................... fdmawds
    Client App....................................... WebClient
    CONNECTION:
    Provider......................................... ORAOLEDB.ORACLE
    Data Server......................................
    Database Name.................................... HYPUAT
    Trusted Connect.................................. False
    Connect Status.. Connection Open
    GLOBALS:
    Location......................................... GLBS
    Location ID...................................... 749
    Location Seg..................................... 3
    Category......................................... ACTUAL
    Category ID...................................... 13
    Period........................................... Jun - 2012
    Period ID........................................ 6/30/2012
    POV Local........................................ False
    Language......................................... 1033
    User Level....................................... 1
    All Partitions................................... True
    Is Auditor....................................... False

  • IIF with InStr and LEFT -1 Causes #Error in SSRS 2008R2

    Hello,
    I'm using IIF with InStr to test for a "/" in a field on a report.  The left function works fine unless I try to subtract 1 from it.  This code works fine:
    =IIF(InStr(Fields!WellCompName.Value,"/")=0, Fields!WellCompName.Value, left(Fields!WellCompName.Value,InStr(Fields!WellCompName.Value,"/")))
    But this code causes the True condition to yield #Error in the report when I add the -1 to the end of the left function:
    =IIF(InStr(Fields!WellCompName.Value,"/")=0, Fields!WellCompName.Value, left(Fields!WellCompName.Value,InStr(Fields!WellCompName.Value,"/")-1))
    I do need -1 to remove the "/" but it doesn't work with IFF and LEFT.
    Thanks

    Hi SomeDBGuyOutThere,
    I have tested on my local environment and can reproduce the issue, your issue caused by when the value in the field WellCompName don't contains "/". the function "left(Fields!WellCompName.Value,InStr(Fields!WellCompName.Value,"/")-1)"
    in the expression is invalid and will caused the error.
    In your scenario, please modify the second expression as below to avoid the error when there is no "/" in the string:
    =IIF(InStr(Fields!WellCompName.Value ,"/")=0,
    Fields!WellCompName.Value,
    left(Fields!WellCompName.Value,InStr(IIF(InStr(Fields!WellCompName.Value,"/")=0,"Test1/Test2",Fields!WellCompName.Value),"/")-1))
    Note: when WellCompName don't include "/" we given an test string "Test1/Test2" in the expression to avoid the error.
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Still trying to find correct String Function for form search?

    A user enters first 3 letters of a word on a search form- the
    results need to include words which begin with them (e.g. "con"
    returns "Conajoharie" - not case sensitive).
    Using MS Access.
    SELECT myword
    FROM theDB
    WHERE upper(substr(myword,1, 3) = <cfqueryparam
    value="#ucase(form.keyword)#">
    or
    WHERE myword LIKE <cfqueryparam
    value="#form.keyword#*"> don't work
    or
    WHERE myword LIKE '%#form.keyword#' don't work
    no luck so far...
    Any help appreciated.

    For Access? Try....
    SELECT myword
    FROM theDB
    WHERE LEFT(myword, 3) = <cfqueryparam
    value="#Left(form.keyword, 3)#">
    Edit: Added CF Left() function to limit the length of
    form.keyword.
    Phil

  • How can I edit an InDesign file that contains right-to-left text (arabic, hebrew...) with InDesign CC?

    With previous CS versions, there was a special ME (middle east) version of InDesign that had all the necessary right-to-left functions. Is there a CC ME version, or is there another solution?

    So this comes at no extra cost to the CC subscription?
    Yes
    And can it open older files that were created with Indesign CS5 ME for example?
    Yes
    Add to that you can also download and install indesign cs6 version
    Download InDesign CS6 from CC
    http://forums.adobe.com/message/5485418#5485418

  • Microsoft VBScript runtime error '800a005e' Invalid use of Null: 'clng' /mc/functions/rpt_downline.asp, line 187

    while I am in one of my sites I can access most pages except one and I get this message.

    "samspram" <[email protected]> wrote in
    message
    news:fifhoq$cr7$[email protected]..
    > Hi There
    > Thanks for the reply.
    > It is a MySQL DB, the fields I am referencing are TEXT
    datatypes and I
    > have
    > tried referencing them both left and right.
    > The data stored in the fields are comma separated
    strings e.g. 1, 2, 3, 4,
    > which I am loading into Session variables at login with
    the following
    > code:-
    > Session("allowedsubmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_sub_menus").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_sub_menus").Value) -
    1))
    > Session("allowedtopmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_top_menus").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_top_menus").Value) -
    1))
    > Session("allowedempmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_emp_menus").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_emp_menus").Value) -
    1))
    > Session("allowedcoys") =
    > Left(rsLogin.Fields.Item("u_allowed_companies").Value,
    > (Len(rsLogin.Fields.Item("u_allowed_companies").Value) -
    1))
    >
    > If I load the data into a variable before performing the
    Left() function
    > on
    > the field then it goes past the lines OK but when I try
    and use the
    > Session
    > variable it then throws the Invalid Use of Null error
    again.
    > i.e.
    > Dim varNum
    > varNum =
    (Len(rsLogin.Fields.Item("u_allowed_top_menus").Value) - 1)
    > Session("allowedsubmenus") =
    > Left(rsLogin.Fields.Item("u_allowed_sub_menus").Value,
    varNum)
    > Code will execute past the loading of sessions in this
    way but when I try
    > to
    > use the session later i.e. as with the Split() function
    I get the same
    > error
    > again.
    >
    > Regards
    > Brendan
    You are referencing the Recordset Column Value multiple
    times.
    try putting it into a variable first
    varValue = rsLogin.Fields.Item("u_allowed_sub_menus").Value
    then proceed with your operations using that variable
    Session("allowedsubmenus") = Left(varValue , (Len(varValue )
    - 1))

  • Didnt two finger swipe to the left operate as a 'back' button? can i get that back?

    before lion, didnt a 2 finger swipe to the left function as a 'back' button (on websites or in folders)? if so , is there anyway to get that back?

    cristianahunter wrote:
    I need help!! I hadn't plugged my phone into itunes since my computer crashed. I had the option of creating a new phone or restoring to a backup. I didn't really understand the options, so I thought itunes would give me a warning before wiping my device. It didnt, and now I've lost everything. is there a way to get it back?
    If you used icloud to store contacts and calandar then you should be ok there. Also you can redownload any purchashed apps, music, videos, books and anything else you purchashed off itunes. The only thing you might be missing is photos you have taken on the phone, unless you had photo stream activated, then they would be there and you could pull them down into your camera roll. The only other data that would be missing is game data or any other data that apps had stored on the phone. That is why I recommend that anyone with a 3GS or higher should use icloud, photo stream, and itunes match. With those you will never lose any data ever again. You can even do backups to icloud and you can restore straight from the cloud, no itunes required.

Maybe you are looking for

  • Error in Reciever RFC Adapter

    Hi All, While working with JDBCXIRFC, the only error with Reciever RFC Adapter is as follows. ZBAPICUSTOMER_DETAILS: com.sap.aii.af.rfc.afcommunication.RfcAFWException: error while processing message to remote system:com.sap.aii.af.rfc.core.client.Rf

  • Borderless Printing Iphoto 6 and HP 3210x All in One Photosmart

    Hi Folks, Has anyone been able to get Iphoto 6 to print borderless 4x6 photos using a HP 3210 Photosmart Printer? I have tried every setting I can think of but it always prints a 4x6 photo with about a 1/8 inch border at each end. Any suggestions wou

  • Connectivity errors : TNS 15241

    Hello all of you, I'am installing virtual box 4.0 on a windows 7 laptop . I'am trying to put on this virtualization software this prebuilt VM http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html (a Oracle Enterp

  • Sales order posing without Customer

    Hi All, Sales oder data is sent by the third party system to production without customer ( sold-to-Party / Ship-to-Party ) data, it still creates the sales order in Production environment. The Basic type is ORDERS05 and the message type is ORDERS and

  • Shared Variable Data Integrity

    I am using Network Shared Variables for a project and have a question about if there are any data integrity checks that are built into the NI-PSP protocol. I'm more of a hardware engineer and I am just wondering if there is any way that data can be c