Any Infopath function similar to 'REVERSE' function present in SQL - InfoPath Dev
in

InfoPath Dev

Any Infopath function similar to 'REVERSE' function present in SQL

Last post 09-28-2012 03:19 AM by Chakradhar. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 09-26-2012 06:22 AM

    Any Infopath function similar to 'REVERSE' function present in SQL

    Hi Everyone,

     

    I have a textbox and getting the data (multiple words separated by comma) from other fields into it.

     

    Now, I need to restrict the textbox by showing only first 10 characters by removing the remaining characters and also need to remove the word/characters which are coming in middle of 10th character.

     

    So I have written the below query to achieve the same in SQL and it is working fine in SQL.

     

    DECLARE @row varchar(50)

    DECLARE @10Char varchar(50) 

    SET @row = 'OPI,Rock,Template'

    Set @10Char = left ((@row), 11)

    SELECT substring(@10Char,len(Left((@10Char),1)),LEN(@10Char)-CHARINDEX(',',REVERSE(@10Char)))

    Output: OPI,Rock

    (Here the 10th character is coming in-between the word ‘template’, So it removed the completed word ‘template’ after ‘,’)

     

    I tried to apply the same formula in InfoPath, but I didn’t find the REVERSE or CHARINDEX functions present in InfoPath 2010.

     

    Please let me know how we can achieve the above functionality using Rules and functions (Codeless) at the earliest as possible.

     

    Thanks in advance.

    Chakradhar.

     

  • 09-26-2012 06:40 AM In reply to

    Re: Any Infopath function similar to 'REVERSE' function present in SQL

    Hi Everyone, To be more precise of the above issue:

    If there are lot of words separated by ',' (Comma) in the textbox, then I need to find the LAST ','(comma) and then delete/remove the characters starting from that ','(comma).

     Thanks,

    Chakradhar.

     

  • 09-27-2012 03:10 AM In reply to

    Re: Any Infopath function similar to 'REVERSE' function present in SQL

    Hello EveryOne,

    I found below recursive template on the net for the similar issue, but i am not sure how can below template is used in infopath and resolve the above issue.

    Please can anyone guide me on the same on how to resolve the issue

    <xsl:template name="substring-after-last">
      <xsl:param name="string" />
      <xsl:param name="delimiter" />
      <xsl:choose>
        <xsl:when test="contains($string, $delimiter)">
          <xsl:call-template name="substring-after-last">
            <xsl:with-param name="string"
              select="substring-after($string, $delimiter)" />
            <xsl:with-param name="delimiter" select="$delimiter" />
          </xsl:call-template>
        </xsl:when>
        <xsl:otherwise><xsl:value-of select="$string" /></xsl:otherwise>
      </xsl:choose>
    </xsl:template>

    Thanks,

    Chakradhar.

  • 09-27-2012 05:22 AM In reply to

    Re: Any Infopath function similar to 'REVERSE' function present in SQL

    Chakradhar:
    If there are lot of words separated by ',' (Comma) in the textbox, then I need to find the LAST ','(comma) and then delete/remove the characters starting from that ','(comma).

    Enclosed please find the XSN template demonstrating how to do it in Infopath with rules.

    I have there intermediary data field ending_string where I get the ending after last comma string  having organized iteration using substring-after( ) function and then using ending_string value to get final result by

    • substring-before(field1; concat(","; ending_string))

     

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 09-28-2012 03:19 AM In reply to

    Re: Any Infopath function similar to 'REVERSE' function present in SQL

    Hi Vanin,

    It is what i was looking after, Thanks a ton, you saved my day.

    Chakradhar.

Page 1 of 1 (5 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.