OBIEE - Find position of the last occurrence of a charcter within a string.

Hi,
I have a requirement in 11.1.1.6.9 to be locate the position of the last occurrence of a character within a string.
i.e. Given the following, I would want to locate the last "/":
This/is/an/exampleI would like to return a value of 11. Now, there could be any number of "/" so I can't always locate the nth one - it must be the last one.
Anyone any ideas?
Thanks,
John

Your requirement is not complete. just in case you want to extract the last part 'example' just use substring and replace to trim up to required part.
You may have to go for the same for multiple times.
ETL is the best to handle this than BI.
BTW: Check this How to use locate function if multiple occurences of same character
Edited by: Srini VEERAVALLI on May 10, 2013 10:25 AM
Good that given link is helped you to solve it ;)
Edited by: Srini VEERAVALLI on May 13, 2013 7:47 AM

Similar Messages

  • Trying to determine the last occurence of a number within a word string.

    Hi All,
    I am trying to find the last occurence of a number within a string. I have had a quick look at the Java Tutorial and know about lastIndexOf and substring. The thing is I have to test for the existance of the numbers 0-9 within a product code that typically looks like this:
    s1_14G12B
    s1_17G1BA
    s2_24GD
    The only part of the above strings that I am interested in is the letter(s) that follow the very last number, so in the case of those codes presented above, I would like to extract the following:
    B
    BA
    D
    I have written some code that performs a similar operation:
    public class FindPriceCode
      private String priceCode;
      private String[] numberValues = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
      public FindPriceCode()
        priceCode = "s2_71G4BA";
        for(int i=0; i<numberValues.length; i++)
          int location = priceCode.lastIndexOf(numberValues);
    System.out.println("Character " + numberValues[i] + " found at position: " + location);
    public static void main(String[] args)
    FindPriceCode myPriceCode = new FindPriceCode();
    ...finding the location of numberValues string within the given example code. I am now at a loss as to how I can determine the location of the last number occurence (moving right to left) and then build a substring from that number. Any help will be greatly appreicated.
    Thanks
    David

    Hello,
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class CutNumberTest extends JFrame implements ActionListener {
         private JTextField input= new JTextField(10);
         private JTextArea result=new JTextArea(10,10);
         char[]numbers=new char[]{'0','1','2','3','4','5','6','7','8','9'};
         public CutNumberTest() {
              super("CutNumberTest");
              setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              JButton cutButton = new JButton("cut number");
              cutButton.addActionListener(this);
              JPanel topPanel=new JPanel();
              JLabel label=new JLabel("Please enter price-code:");
              topPanel.add(label);
              topPanel.add(input);
              topPanel.add(cutButton);
              getContentPane().add(topPanel, BorderLayout.NORTH);
              getContentPane().add(new JScrollPane(result));
              pack();
              setLocationRelativeTo(null);
         public void actionPerformed(ActionEvent e) {
              char[] code=input.getText().toCharArray();          
              int counter=code.length;
              boolean lastNumFound=false;
              while(!lastNumFound && --counter >= 0)
                   lastNumFound=isNumber(code[counter]);
              result.append(lastNumFound ? "result: "+input.getText().substring(counter+1)+"\n" : "No number found!\n");
         private boolean isNumber(char chr){
              boolean isNumber=false;
              int counter=-1;
              while(++counter < numbers.length && !isNumber)
                   isNumber=numbers[counter]==chr;
              return isNumber;
         public static void main(String[] args) {
              new CutNumberTest().setVisible(true);
    }//copy/paste:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class CutNumberTest extends JFrame implements ActionListener {
         private JTextField input= new JTextField(10);
         private JTextArea result=new JTextArea(10,10);
         char[]numbers=new char[]{'0','1','2','3','4','5','6','7','8','9'};
         public CutNumberTest() {
              super("CutNumberTest");
              setDefaultCloseOperation(DISPOSE_ON_CLOSE);
              JButton cutButton = new JButton("cut number");
              cutButton.addActionListener(this);
              JPanel topPanel=new JPanel();
              JLabel label=new JLabel("Please enter price-code:");
              topPanel.add(label);
              topPanel.add(input);
              topPanel.add(cutButton);
              getContentPane().add(topPanel, BorderLayout.NORTH);
              getContentPane().add(new JScrollPane(result));
              pack();
              setLocationRelativeTo(null);
         public void actionPerformed(ActionEvent e) {
              char[] code=input.getText().toCharArray();          
              int counter=code.length;
              boolean lastNumFound=false;
              while(!lastNumFound && --counter >= 0)
                   lastNumFound=isNumber(code[counter]);
              result.append(lastNumFound ? "result: "+input.getText().substring(counter+1)+"\n" : "No number found!\n");
         private boolean isNumber(char chr){
              boolean isNumber=false;
              int counter=-1;
              while(++counter < numbers.length && !isNumber)
                   isNumber=numbers[counter]==chr;
              return isNumber;
         public static void main(String[] args) {
              new CutNumberTest().setVisible(true);
    Regards,
    Tim

  • How to find out when the last time a tcode was run by someone

    Hi Team,
    I am just trying to find out if there is a way to find out when the last time a tcode was run by someone.I mean i need to know when was a certain  tcode was last run.
    Thanks,
    Priyanka

    HI Priyanka
    Another way would be using transaction STAT,enter the t-code you like to monitor.This will provide all details,like user, time etc...
    Hope this will help
    Thanks
    Santosh Kumar

  • I deleted photos cause the capacity is so big but i backup first on itunes then when i was to restore some of those i cannot find photos from the last backup that i 've done. What to do?

    I deleted photos cause the capacity is so big but i backup first on itunes then when i was to restore some of those i cannot find photos from the last backup that i 've done. What to do?

    As far as i know, you can use a third party iPad photos recovery software to have a try. If i remember correctly, this software has two methods to restore your photos. One is recovering from your iTunes backup, another is recovering from your iPad directly.
    http://easy-iphone-recovery.blogspot.com/iphone-recovery-resource.html
    It is worth to try if your photos are important.

  • Add effects the last occurrence of a sound

    Hello,
    is there a way to add an effect the last occurrence of a sound? That is to say if I have lead synth playing and then at the point I want the sounds to finish I want echo effect. I can I add that some how the end of the lead or do I need to have a separate track just for that effect?
    Thanks!

    Have you worked through the "Exploring Logic Pro" manual? It introduces these things and gives you a tour through the basic functions so you know how to do the core stuff.
    Each channel strip has sends (underneath the insert slots and above the I/O slots). If you send to Bus 1, and turn up the send knob next to the send you've just added, then place your delay plugin on the new aux channel strip that is created (which will have Bus 1 as it's input), now your audio is being send to the delay.
    Then you automate the send knob just like you automate any other parameter in Logic. If you don't know what automation is, or how to do it, again, work through the small introductory Exploring Logic Pro manual to get the basic concepts.

  • How can I get the last occurrence of a repeated item in Numbers

    Hi everyone, I'm hoping this question has a straightforward answer.
    I have a simple 2-column table (Table 1). Column A is a list of names. Column B is a list of dates where those names have had appointments. (Most names in Column A are repeated because they have had multiple appointments).
    I'd like to create an automated table based Table 1 that lists each name from Column A only once, with the last appointment that each person has had.
    Any ideas, I'd be grateful.
    Thanks!

    Hi Paul,
    Late to the party, as I was called to dinner shortly after starting on a solution and wasn't able to get back to it for a few hours.
    This was worked out in Numbers '09 (v2.3), but the formulas should work as well in Numbers 3. The solution requires the data on the Data table to be entered (or sorted) in ascending order of dates. Dulicate dates, though not included in the example, should not create an issue.
    The added column (Name index—column C) may be hidden. It is needed to mark the first occurrence of each name, and required only if you want the name list in column A of the summary table (Most recent appointment) filled automatically.
    Formulas:
    Data::C2, and filled down to the end of column C: =IF(COUNTIF($A$2:A2,A)=1,MAX($C$1:C1)+1,"")
    COUNTIF($A$2:A2,A) counts the number of occurences of the name in the same row as the formula from row 2 of column A to the row containing the formula. IF that count is 1, the number of the row is placed in the cell, otherwise the cell receives a null string ( "" ).
    Most recent appointment table:
    A2, and filled down to end of column A:
    =IF(ROW()-1>MAX(Data :: C),"",OFFSET(Data :: $A$1,MATCH(ROW()-1,Data :: $C,0)-1,0))
    If the row number minus 1 is greater than the number of distinct names in the index column, a null string is placed in the cell. Otherwise, the OFFSET function uses MATCH to determine the row in which to find the next name (in order of first appearance) and places that name in its cell.
    B2 and filled down: =IF(LEN(A)>0,LOOKUP(A,Data :: $A,Data :: $B),"")
    IF here uses LEN() to determine if there is data (a name) in column A. If so, then LOOKUP looks up the name in column A of the Data table and returns the date from the same row of column B. If there's no data (name) in column A, IF places a null string in the cell.
    This formula takes advantage of the fact that LOOKUP searches from the bottom of the column, and returns the result from the first match it finds.
    Regards,
    Barry

  • I lost all my bookmarks and i can't find them in the last ten packups.How can i bring them back?

    i'm not sure what i have done...either i reinstalled forefox or updated it before and then..i didn't find any of my bookmarks..i restored already the oldest one of the last ten packups...but i couldn't find any of them too..i don't know how this could happen with firefox..plz tell me how can i bring them back?..

    Hi youssef8888, you might also want to search your entire C drive to see whether your bookmark backup files might be in an unexpected location. I would try this pattern:
    bookmarks-2013*.*
    To make sure your search checks for hidden files and folders, see this article from Microsoft: [http://windows.microsoft.com/en-us/windows/show-hidden-files].

  • Help to find WorkID before the last touch transaction

    Hi,
    May I ask your help on how to find the transaction (WorkID) or touched before the last transaction.
    The last touched or transaction for per Itemcode should be "FJ_CBDEF". I have a sample data and DDL as your reference. In my Sample data the 2 result item will be "FJ_LMDADS" and "FJ_CBVFI2"
    sample:
    FJ_ENTRY
    FJ_LMDADS--retrieve this workid
    FJ_CBDEF--last touched
    Create table #maintable
    (Item nvarchar(35), Itemcode nvarchar(35))
    Insert into #maintable(item,itemcode) values ('AAAAA','RPT00000001')
    Insert into #maintable(item,itemcode) values ('BBBBB','RPT00000002')
    Create table #Table1
    (Itemcode nvarchar(35), RankNum int, WorkID nvarchar(35), CreatedDatetime datetime)
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000001','5','FJ_Pentry','2015-01-12 23:50:48.000')
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000001','15','FJ_CBDEF','2015-01-14 05:23:10.000')
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000001','10','FJ_LMDADS','2015-01-13 15:03:56.000')
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000002','0','FJ_Pentry','2015-01-12 23:53:47.000')
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000002','10','FJ_LMDADS','2015-01-13 14:52:15.000')
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000002','15','FJ_DiAss','2015-01-13 16:24:35.000')
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000002','20','FJ_CBVFI2','2015-01-13 19:47:36.000')
    Insert into #table1(itemcode, RankNum, WorkID,CreatedDatetime) values ('RPT00000002','25','FJ_CBDEF','2015-01-14 05:22:52.000')
    Create table #Table2
    (Itemcode nvarchar(35), RankNum int, WorkID nvarchar(35), CreatedDatetime datetime, FCode nvarchar(5))
    Insert into #table2(itemcode, RankNum, WorkID, CreatedDatetime, FCode) values ('RPT00000001','10','FJ_LMDAD','2015-01-12 23:50:48.000','FJ001')
    Insert into #table2(itemcode, RankNum, WorkID, CreatedDatetime, FCode) values ('RPT00000002','20','FJ_CBVFI2','2015-01-13 19:47:36.000','FJ004')
    Select m.Item, m.Itemcode, t1.RankNum, t1.WorkID, t1.CreatedDatetime, t2.FCode,
    rn=ROW_NUMBER() OVER (partition by m.Itemcode order by m.Itemcode , t1.CreatedDatetime desc )
    From #maintable m
    Left join #Table1 t1
    On t1.Itemcode = m.Itemcode
    Left Join #Table2 t2
    On t2.Itemcode = t1.Itemcode and t2.RankNum = t1.RankNum
    Order by m.Itemcode, t1.RankNum

    select * from (
    Select m.Item, m.Itemcode, t1.RankNum, t1.WorkID, t1.CreatedDatetime, t2.FCode,
    rn=ROW_NUMBER() OVER (partition by m.Itemcode order by t1.CreatedDatetime desc )
    From #maintable m
    Left join #Table1 t1
    On t1.Itemcode = m.Itemcode
    Left Join #Table2 t2
    On t2.Itemcode = t1.Itemcode and t2.RankNum = t1.RankNum )
    t
    WHERE rn=2
    Order by Itemcode, RankNum

  • How to find FIRST and the LAST date of the month.

    Hello,
    I want to find the first and the last date of the current month through query. How is it possible please help.
    For example if the current month is july. The first date should be 01-JUL-2006 and the last date would be 31-JUL-2006.
    Please help me.
    Regards,
    Imran Baig

    Like this?
    SQL> select trunc(sysdate,'MM') "First_Day",
      2        last_day(sysdate) "Last_Day" from dual;
    First_Day Last_Day
    01-JUL-06 31-JUL-06
    SQL> select trunc(to_date('10-FEB-04'),'MM' ) "First_Day",
      2       last_day(to_date('10-FEB-04')) "Last_Day" from dual;
    First_Day Last_Day
    01-FEB-04 29-FEB-04

  • Find my iphone... does it find it from the last back up?

    I lost my phone today and when I used the find my iphone tool, it says it is somewhere in my home, but I have searched high and low.. to no avail. The device has nto been backed up in months, becuase theres to much data; does it work from the last time i backed it up, or does that not amke a difference

    That backup function of iCloud and the Find My iPhone feature are two seperate features and have absolutely no effect on each other.  If you are able to locate the device, that means it is currently on and you should be able to use the 'Play a Sound' feature form the Find My iPhone App or icloud.com/find and it will make a very loud annoying alert just for situations like yours, even if the iPhone is on silent.

  • How to get the first and the last record of every month within a time range in sql

    I am trying to get the first record and the last record of each and every month in a given date range using sql. I have a sample code
    where i have just selected everything within the date range now i have to extract the first and the last records of each and every month.
    SELECT PurOrderNum,
    OrderDate
    FROM Purchasing.PurOrder
    WHERE OrderDate >= '2013-02-28'
    AND OrderDate <= '2014-12-29'

    SELECT PurOrderNum,
    OrderDate
    FROM
    SELECT PurOrderNum,
    OrderDate,
    MAX(OrderDate) OVER (PARTITION BY DATEDIFF(mm,0,OrderDate)) AS MaxDate,
    MIN(OrderDate) OVER (PARTITION BY DATEDIFF(mm,0,OrderDate)) AS MinDate
    FROM Purchasing.PurOrder
    WHERE OrderDate >= '2013-02-28'
    AND OrderDate <= '2014-12-29'
    )t
    WHERE OrderDate = MaxDate
    OR OrderDate = MinDate
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Remove the last chr(13) & chr(10) from a string

    Hello, all.
    I'm trying to get confirmation files to upload to Amazon for their "Charge When Ship" program.  I've got the file creating as it should be with one minor exception.
    I'm setting a variable, giving it the header column information and ending that with chr(13) & chr(10); then I'm looping through a query to add the information, each iteration tacks chr(13) & chr(10) to the end of it; then I'm taking that variable and writing the data to a file using CFFILE.
    But I think that the last chr(13) & chr(10) is causing Amazon servers to think there's one more line of information than there really is, and it's erroring.
    Can anyone tell me how to remove that last chr(13) & chr(10) from the variable before writing it to file?
    Thanks,
    ^_^

    giving it the header column information and ending that with chr(13) & chr(10); then I'm looping through a query to add the information, each iteration tacks chr(13) & chr(10) to the end of it; then I'm taking that variable and writing the data to a file using CFFILE.
    Trim() the variable or change the code so it does not generate an extra new line.
    Since your content has a header, place the new line characters at the beginining of each query iteration.
    #headerColumnsHere#  <!--- notice there is no new line after the column header  information --->
    <cfouput query="yourQuery">#chr(13)##chr(10)# #ColumnA##ColumnB#...etcetera...</cfoutput>

  • Searching for the nth occurrence of a substring in a string

    I need to search for the 63rd occurrence of a substring <i4> and replace it with <string>. Is there an easy way to do this?
    Edited by: sarcasteak on Jun 16, 2009 11:52 AM

    nevermind I got it, if anyone was curious
    int z = 0;
                   while(z<63)
                        index = index2+3;
                        index2 = result.indexOf("<param>", index);
                        resultTest = result.substring(index2);
                        //System.out.println(index2 + " :" + resultTest );
                        z++;
                   String originalSubstring = (result.substring(index2);
                   String modifiedSubstring = "";
                   modifiedSubstring = originalSubstring.replaceFirst("<i4>","<string>" );
                   modifiedSubstring = modifiedSubstring.replaceFirst("</i4>","</string>" );
                   String fixedString= result.replace(originalSubstring, modifiedSubstring);
                   System.out.println(fixedString);Edited by: sarcasteak on Jun 16, 2009 12:32 PM

  • My photos are not working, any recently taken photos won't show, they're just like blank grey pictures & all my photos cannot be uploaded or loaded into an editing tap, it says error, cannot find photo, and the last photo I take ends up being repeated!

    someone please help me! I just traveled to hong long and the minute I arrived something wrong was happening with my photos, I can't take any new photos because if I did they either get repeated or just be shown as grey pictures and when I try to upload one to a photo editing app it says "error cannot Load photo" and the same happens in twitter and Facebook! this has been found on for Like more than a week now, even when I want to set a picture as my profile picture in man it ends up zooming the picture way more than how I chose it in the border,, I would like to be able to take good photos again, any help?

    1. You did not get an error message telling you that your iPhoto library was getting full. You got a message telling you that your HD was getting full, right?
    OS X needs about 10 gigs of hard drive space for normal OS operations - things like virtual memory, temporary files and so on.
    Without this space your Mac will slow down as the OS hunts for space on the disk, files will be fragmented, also slowing things down, apps will crash and the risk of data corruption - that is damage to your files, photos, music - increases exponentially.
    Your first priority is to make more space on that HD. Nothing else can be done until you do.
    Purchase an external HD and move your Photos and Music to it. Both iPhoto and iTunes can run perfectly well with the Library on an external disk.
    Your Library has been damaged from being run on an overfull disk.
    How much free space on it now?

  • Reference the "Noteproperty" of an object from within a string

    Hello...this is more of a learning question...I am just curious if there is a more effecient way to do something:
    Lets say I have the following code (simplified version of what am I actually trying to do):
    $ServerObject = New-Object System.Object
    $ServerObject | Add-Member -Type NoteProperty -Name ServerName -Value "MYSERVER"
    $ServerObject | Add-Member -Type NoteProperty -Name OS -Value "WIN2008R2"
    $Server = $ServerObject | Select-Object ServerName,OS
    And I want to do something like this:
    Write-Host "$Server.ServerName is blah blah blah...."
    But obviously this does not work.  Is there a way to code this without creating a second variable?  For example, I know this will work:
    $MyServerName = $Server.ServerName
    Write-Host "$MyServerName is blah blah blah"
    But I am wondering if there is a better way to do this without a second variable.  I have tried:
    $(Server).ServerName
    $(Server.Server)
    {$Server.ServerName}
    And a few others - but none of these work (other than using a second variable).  Obviously my real script involves 100's of servers in an array of objects, but for purposes of my question, the above code similutes what I am trying to do.  I have
    also looked into concatenating the strings, but in my real script I am using Out-File and it tells me I cannot use the "+" operator for the -Input parameter...so I would still have to use a second variable.
    Thanks
    NK

    I was soooo close!  Thanks.  Oh and I think you missed a "(".  I think it should be:
    Write-Host "$(($Server).ServerName) is blah blah blah"
    thanks again,
    NK

Maybe you are looking for

  • How do you separate bookmarks for two different users on the same computer?

    My wife and I use the same desktop and the same Firefox browser. Is there a way to have separate bookmark lists for each of us? We don't really need subtopics or other organizers, just two separate lists.

  • Fetching data from HR_READ_Infotype

    Hi, I am fetching the data from pa0001,pa0002 and pa0105 using the function module 'HR_READ_Infotype' like below: CALL FUNCTION 'HR_READ_INFOTYPE'     EXPORTING       TCLAS                 = 'A'       pernr                 = wa_pa0002-pernr       inf

  • Export AVI files to iMovie

    Hello, sorry for my english, I'm getting mad... I have an avi file with following parameter: DivX 4 (Perian), 720 x 480, Milioni MPEG Layer 3, Stereo, 48,000 kHz 29,97 FPS it's about 600 MB I would like to import it in iMovie, so I try to export it a

  • Debuging of SAP script  SARTFORMS

    Can we debug SAP Scripts & SAMRTFORMS SHAOIB

  • ReEncryptingDomainPasswordsPattern for Portal 10.0 MP1

    Hi I have the same problem as posted in this page : http://support.bea.com/application_content/product_portlets/support_patterns/wlp/ReEncryptingDomainPasswordsPattern.html Is this solved for bea portal 10.0 mp1 ? I dont see a link on the page. -Stål