Mapping string to n substring and then to m subsubstrings

Hi,
I need some advice/input for a mapping.
MT_Source            Occurence
   ROW                  1
      Customer         1
      Article              1
MT_Target
   ROW                   1:n
      Customer          1
      field1                 1
      field2                 1
      field3                      1
Article field from source is a string of N-times 5 characters
Requirements for mapping are:
The target structure must have N rows
Then the string must be substringed to N-strings
Each field1,2,3 is substring of one substring.
Example
MT_Source looks like:
<row>
customer is X
article is string "12345ABCDE"
</row>
MT_Target must be like:
<row>
customer X
field1       12
field2       34
field3       5
</row>
<row>
customer X
field1       AB
field2       CD
field3       E
</row>
Can it be done with graphical mapping and udf?
Or is it better to do it all in one XSLT or JAVA or ABAP mapping?
Any coding examples u can give are much appreciated.
Kr
Robert

Hi Anand, Sarvesh,
First of all: thx a lot for all your valuable inputs.
The only issue left for me was the customer. Just Copyvalue never worked because in source structure there is one and only one value, and it never became two.
I've solved this also inside my UDF now. I've added one input (var2) and one output (result5) it and looks like this now:
public void allinONE(String[] var1, String[] var2, ResultList result1, ResultList result2, ResultList result3, ResultList result4, ResultList result5, Container container) throws StreamTransformationException{
int test=var1[0].length();
test=test/5;
for(int i=0;i<test;i++){
     result1.addValue("");
    result5.addValue(var2[0]);
    result5.addContextChange();
String str="";
for(int j=0;j<test;j++)
str=var1[0].substring(j*5,(j*5)+5);
result2.addValue(str.substring(0,2));
result3.addValue(str.substring(2,4));
result4.addValue(str.substring(4,5));
result2.addContextChange();
result3.addContextChange();
result4.addContextChange();
This gets me exactly the output i need.
Again thx for the input
I'll keep exploring
kr
Robert

Similar Messages

  • Read this if Maps v2 loads to 30% and then quits ....

    The solution to this problem is to delete the mapping data stored on your memory card, and try loading Maps v2 again.
    Once it has loaded completely once, you can then quit and load the mapping data that you need to the memory card without problem.
    Hope this helps.
    Message Edited by edwardquan on 01-Jun-2008 03:23 PM
    Regards,
    Edward

    Hello there,
    In my case it stops to load at 90% and then just quits.
    I then started Jakka's Crash Monitor for analysis and found out: The reason is a Panic: 12,User. (on a E51 with 4GB card and about 1 GB used for Maps, no other programs running except the normal system standards, like phone, led, email-in, aso)
    The funny thing: It worked fine until this afternoon at 3 pm. I reached my target quit the program and fine. At 5 pm (nothing installed or so in the meantime) i wanted to drive somewhere else and... f***.
    So I ended up in buying a map.
    Shall I always carry my my PC with me when on the road to clean up the cache to be able to continue to use it?
    I need a tool not a toy.
    And well... that PC Nokia Maps Loader can also not be considered as a serious piece of software, more kind of an alpha-state program.
    It does not allow you to see what you already have installed neither can you remove any maps selectively.
    Also there is no chance to edit or delete your own locations and and and.
    I was thinking about to extend my 1 month trial to a real long-term subscription... but i will better invest the money in real maps (paper) as they will be always availiable and i will not be lost in the middle of nowhere just as maps will decide again to panic.
    Nokia really has to make some improvements to become a serious competitor to R66 or Garmin. Not to mention real devices like TomToms.
    Another story is the quality the routing...
    For that i will start a seperate thread so now here just short:
    on sunday i was standing in front of a locked gate of a unpaved road in northern hungary and 1 hour later i wanted to call the nearest Hummer-Dealer to buy one of their vehicles to continue on the road the system selected (set on FASTEST! not or shortest!) and in Northern Slovakia you will end up as food for the bears if you trust your navigation-system.
    (Nokia: If you you read this and dont believe it... try to come to visit me... i will rescue you when you are stuck and lost - i promise!)
    w.

  • How can I put a stl::vector string into the DB and then get it out?

    Hello,
    As the title, here's a test case with problems,but anyway you can still run it. ( VC6/XP-32/BDB 4.7 )
    I know this may be wrong,and I'd like to know how can I do this.
    Can someone help me please? I would appreciate it very much.
    ************ Copy,Compile and Run ***************
    #include <iostream>
    #include <vector>
    #include "db_cxx.h"
    int main()
         std::string dbName("database.db");
         u_int32_t db_flags=DB_CREATE;
         Db* db=NULL;
         // Prepare key(int)/data(vector<string>) pair.
         int int_key=2;
         std::vector<std::string> rec_data;
         rec_data.push_back("apple");
         rec_data.push_back("Bob");
         rec_data.push_back("Me");
         // Prepare Dbt for receiving.
         std::vector<std::string> rec_readData;
         Dbt readData;
         readData.set_data(&rec_readData);
         readData.set_ulen(sizeof(rec_readData));
         readData.set_flags(DB_DBT_USERMEM);
         try
              // Open database.
              db = new Db(NULL,0);
              db->open(NULL,dbName.c_str(),NULL,DB_BTREE,db_flags,0);
              // Put
              int ret;
              if(ret=db->put(NULL,new Dbt(&int_key,sizeof(int_key)),new Dbt(&rec_data,sizeof(rec_data)),DB_NOOVERWRITE)==0)
                   std::cout<<"put successful!"<<std::endl;
              else { db->err(ret,"Db->put"); }
              // Get
              if(ret=db->get(NULL,new Dbt(&int_key,sizeof(int_key)),&readData,0)==0)
                   std::cout<<"get successful!"<<std::endl;
              else { db->err(ret,"Db->get"); }
         catch(DbException &e)
              std::cerr<<"Error: ";
              std::cerr<<e.what()<<std::endl;
         // Close the database
         try
              if(db!=NULL)
                   db->close(0);
         catch(DbException &e)
              std::cerr<<"Error closing database: ";
              std::cerr<<e.what()<<std::endl;
         // Display the results.
         // Index out of bounds. <-----
         std::cout << rec_readData[0].c_str();
         std::cout << rec_readData[1].c_str();
         std::cout << rec_readData[2].c_str();
         system("pause");
         // Press any key to go wrong. :(
         return 0;
    Regards,
    legendsino

    You need to convert the std::vector<std::string> into a sequence of bytes. For example, if all strings are shorter than 256 characters, you could create a fresh output string, iterator through the vector, and for each element, append the string length to the output string, followed by the string contents.
    Note that ordering in the database will be different from lexicographic order, and you have to keep that in mind when performing range queries.

  • How can I use wget, cron and Automator to periodically pull a dynamic image from a URL to local storage, and then update a Keynote slide with that image, automatically?

    How can I use wget, cron and Automator to periodically pull an image from a URL (which is dynamically updated - like a weather map, say - to local storage, and then update a Keynote slide with that image, automatically?

    Any particular reason for those specific technologies?  wget does not exist on a mac, although you can nstall it I guess.  OS X has curl installed which should do pretty much anything you want to do with wget.  cron is being replaced by launchd, although cron still exists on mountain lion.
    As far as I can tell from automator all the standard 'actions' to access keynote  available to it require keynote to be open and running, but does not provide a function to actually open it.  So I think you will have to write some applescript, as a minimum to open and quit keynote. I notice that the keynote actions are mostly circa 2005 an wonder if they would even work.
    Under utilities in automator 'actions' there is a capability to add applescripts as part of the workflow.
    Also, note that cron is being dprecated by Apple and replaced by launchd.  that said cron is stil on my mountain lion instalation.
    This entry at stackoverflow shows use of cron with curl to get web urls.  http://stackoverflow.com/questions/1683620/getting-started-with-cronjobs-on-a-ma c
    If I have any time I may try and get this to work as it is quite interesting and new to me.  But otherwise, good luck.

  • How do i read a text file and then display the content as a string

    I also would like to strip the string from a certain substring and convert the remaining string into an array of floating point numbers. I was thinking of using the read from spreadsheet vi but I'm not exactly sure if that is going to work. Any help would be greatly appreciated.
    Solved!
    Go to Solution.

    Here is what I have so far. What I am trying to do is to display the text file as a string and then strip the "curve" from the text file. I think I did this successfully. Now I want to convert the remaining string into an array of floating point numbers, and display the numbers into an array and on a waveform graph.
    Attachments:
    hw3datafile.txt ‏1 KB
    Q4.vi ‏7 KB

  • The application maps is not working. When I try to run it opens for a few seconds with a blank screen and then closes

    The application maps is not working. When I try to run it opens for a few seconds with a blank screen and then closes.

    Try a reset by pressing the home and sleep buttons until you see the Apple logo, ignoring the slider. Takes about 5-15 secs of button holding and you won't lose any data or settings.

  • I can't open the app store, safari the mail app, youtube app and the maps app. they try to open then close very quickly. what can I do?

    I can't open the app store, safari the mail app, youtube app and the maps app. they try to open then close very quickly. what can I do?

    Try downloading another app - any free app - that seems to reset something and the apps may start working again. Try that first. If that doesnt work, try these steps
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Close all apps. Go to the home screen first by tapping the home button. Quit/close open apps by double tapping the home button and the task bar will appear with all of you recent/open apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner to close the apps. Restart the iPad. Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.

  • Is it possible to save an iPhone back up and access the files later if needed?  I have a string of text sms and iMessages that I would like to save and then delete them from my phone.  Is this possible?

    I have a string of text sms and iMessages that I would like to save and then delete them from my phone, but gain access to them later if I need them.  I prefer to have the string with the date/time stamp vs copying and pasting into a doc or text file.  Is this possible?

    Not unless you buy an app that accesses data from an iTunes backup.  Check in the app store.

  • Scipt to prompt and authenticate users to AD and then map 2 next available drive letters to 2 network shares

    Hi,
    So I have been trying to write some code that will
    prompt users to authenticate to AD and use that authentication to map the next 2 available drive letter to two network shares.
    I have adopted using the HAT format as this provides me with the ability to prompt for a username and password and authenitcate to AD.
    <script language="vbscript">
    Function setSize()
    window.resizeTo 350,300
    Window.moveTo (screen.width-240)/2, (screen.height-600)/2
    End Function
    Function cmdSubmit_OnClick()
    Dim strUser 'User Name variable
    Dim strPW 'User Password variable
    if auth.username.value = "" Then
    msgbox ("ERROR: No User account information provided. Please Try Again!")
    cmdSubmit_OnClick = False
    Elseif auth.password.value = "" Then
    msgbox ("ERROR: No User account information provided. Please Try Again!")
    cmdSubmit_OnClick= False
    Else
    strUser = auth.username.value
    strPW = auth.password.value
    Authenticate strUser, strPW
    End If
    End Function
    Public Sub Authenticate (Byref strUser, Byref strPW)
    On Error Resume Next
    Const ADS_SECURE_AUTHENTICATION = &H1
    Const ADS_SERVER_BIND = &H200
    Dim strPath 'LDAP path where the Users accounts are listed
    Dim LDAP 'Directory Service Object reference variable
    Dim strAuth 'Parses the User Name and Password through the DSObject
    strPath = "LDAP://fanzldap.au.fjanz.com/rootDSE"
    Set LDAP = GetObject("LDAP://company/rootDSE")
    Set strAuth = LDAP.OpenDSObject(strPath, strUser, strPW, ADS_SECURE_AUTHENTICATION Or ADS_SERVER_BIND)
    If Err.number <> 0 Then
    intTemp = msgbox(strUser & " could not be authenticated", vbYES)
    if intTemp = vbYes Then
    'window.location.reload()
    End If
    Else
    For Each obj in strAuth
    If obj.Class = "user" Then
    If obj.Get("samAccountName") = strUser Then
    msgbox ("Success! " & strUser & " has been authenticated with Active Directory")
    window.close()
    Set wShell = CreateObject("Wscript.shell")
    wShell.run "Firstletterali.vbs"
    End If
    End If
    Next
    End If
    End Sub
    </script>
    <head>
    <body style="background-color:#B0C4DE">
    <img src=Title.jpg><br>
    <HTA:APPLICATION
    APPLICATIONNAME="User Login"
    BORDER="thin"
    SCROLL="no"
    SINGLEINSTANCE="yes"
    WINDOWSTATE="normal">
    <title>NAS Authentication</title>
    <body onload="vbs:setSize()">
    <div class="style2">
    <h3>NAS Archive Authentication</h3>
    </div>
    <form method="post" id="auth" name="auth">
    <span class="style3"><strong>User Name:&nbsp; </strong></span>
    <input id="Username" name="Username" type="text" style="width: 150px" /><br>
    <span class="style3">
    <strong>Password:&nbsp;&nbsp;&nbsp;&nbsp; </strong></span>
    <input id="password" name="password" type="password" style="width: 150px" /><br><br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <input type="submit" value="Submit" name="cmdSubmit" />
    <input type="button" value="Exit" onclick="self.close()">
    </form>
    </body>
    </html>
    using the above I can succefully authenticate users but I cant work out how to then use that authenticattion to map the next to available drive letters to a network source.
    The code I have for that is
    Option Explicit
    Dim strDriveLetter, strRemotePath, strRemotePath1, strDriveLetter1
    Dim objNetwork, objShell
    Dim CheckDrive, DriveExists, intDrive
    Dim strAlpha, strExtract, intAlpha, intCount
    ' The section sets the variables
    strRemotePath = "\\mel\groups\Team\general"
    strRemotePath1 = "\\mel\groups\Team\specific"
    strDriveLetter = "B:"
    strDriveLetter1 = "H:"
    strAlpha = "BHIJKLMNOPQRSTUVWXYZ"
    intAlpha = 0
    intCount = 0
    err.number= vbEmpty
    ' This sections creates two objects:
    ' objShell and objNetwork and then counts the drives
    Set objShell = CreateObject("WScript.Shell")
    Set objNetwork = CreateObject("WScript.Network")
    Set CheckDrive = objNetwork.EnumNetworkDrives()
    ' This section operates the For ... Next loop
    ' See how it compares the enumerated drive letters
    ' With strDriveLetter
    On Error Resume Next
    DriveExists = False
    ' Sets the Outer loop to check for 24 letters in strAlpha
    For intCount = 1 To 24
    DriveExists = False
    ' CheckDrive compares each Enumerated network drive
    ' with the proposed drive letter held by strDriveLetter
    For intDrive = 0 To CheckDrive.Count - 1 Step 2
    If CheckDrive.Item(intDrive) = strDriveLetter _
    Then DriveExists = True
    Next
    intAlpha = intAlpha + 1
    ' Logic section if strDriveLetter does not = DriveExist
    ' Then go ahead and map the drive
    'Wscript.Echo strDriveLetter & " exists: " & DriveExists
    If DriveExists = False Then objNetwork.MapNetworkDrive _
    strDriveLetter, strRemotePath
    call ShowExplorer ' Extra code to take you to the mapped drive
    ' Appends a colon to drive letter. 1 means number of letters
    strDriveLetter = Mid(strAlpha, intAlpha,1) & ":"
    ' If the DriveExists, then it is necessary to
    ' reset the variable from true --> false for next test loop
    If DriveExists = True Then DriveExists = False
    Next
    WScript.Echo "Out of drive letters. Last letter " & strDriveLetter
    WScript.Quit(1)
    'Sub ShowExplorer()
    'If DriveExists = False Then Wscript.Echo strDriveLetter & " Has been mapped for archiving"
    'If DriveExists = False Then objShell.run _
    '("Explorer" & " " & strDriveLetter & "\" )
    'If DriveExists = False Then WScript.Quit(0)
    'End Sub
    On Error Resume Next
    DriveExists = False
    ' Sets the Outer loop to check for 24 letters in strAlpha
    For intCount = 1 To 24
    DriveExists = False
    ' CheckDrive compares each Enumerated network drive
    ' with the proposed drive letter held by strDriveLetter1
    For intDrive = 0 To CheckDrive.Count - 1 Step 2
    If CheckDrive.Item(intDrive) = strDriveLetter1 _
    Then DriveExists = True
    Next
    intAlpha = intAlpha + 1
    ' Logic section if strDriveLetter1 does not = DriveExist
    ' Then go ahead and map the drive
    'Wscript.Echo strDriveLetter1 & " exists: " & DriveExists
    If DriveExists = False Then objNetwork.MapNetworkDrive _
    strDriveLetter1, strRemotePath1
    call ShowExplorer ' Extra code to take you to the mapped drive
    ' Appends a colon to drive letter. 1 means number of letters
    strDriveLetter1 = Mid(strAlpha, intAlpha,1) & ":"
    ' If the DriveExists, then it is necessary to
    ' reset the variable from true --> false for next test loop
    If DriveExists = True Then DriveExists = False
    Next
    WScript.Echo "Out of drive letters. Last letter " & strDriveLetter1
    WScript.Quit(1)
    Sub ShowExplorer()
    If DriveExists = False Then Wscript.Echo strDriveLetter & " Has been mapped for archiving"
    If DriveExists = False Then objShell.run _
    ("Explorer" & " " & strDriveLetter & "\" )
    If DriveExists = False Then WScript.Quit(0)
    End Sub
    Now the above script will find the next availabe letter and map one location to it...I still havent worked out to create another loop for it to do it again. It obviously also requires that you already be authenticated to map to that location.
    I looking for some help on how to marry these to scripts together.
    Thanks
    Ali

    Hi Ali
    Here is some code that will enumerate two free adjacent drive letters. It starts searching from "C" all the way to "Z" for two drives letters that are adjacent and returns the results in an array then echos the results. You can easily adapt this code to
    map your network drives to each drive letter. Hope that helps
    Cheers Matt :)
    Option Explicit
    Dim objFSO
    On Error Resume Next
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    ProcessScript
    If Err.Number <> 0 Then
    WScript.Quit
    End If
    On Error Goto 0
    'Functions Processing Section
    'Name : ProcessScript -> Primary Function that controls all other script processing.
    'Parameters : None ->
    'Return : None ->
    Function ProcessScript
    Dim driveLetters, driveLetter
    If Not GetFreeDrives(driveLetters) Then
    Exit Function
    End If
    For Each driveLetter In driveLetters
    MsgBox driveLetter, vbInformation
    Next
    End Function
    'Name : GetFreeDrives -> Searches for a pair of free adjacent drive letters.
    'Parameters : adjacentDrives -> Input/Output : variable assigned to an array containing the first two free adjacent drives.
    'Return : GetFreeDrives -> Returns True if Successful otherwise returns False.
    Function GetFreeDrives(adjacentDrives)
    GetFreeDrives = False
    Dim drive, driveLetter, drivesDict, i
    Set drivesDict = NewDictionary
    driveLetter = "C"
    'Add the drives collection into the dictionary.
    For Each drive In objFSO.drives
    drivesDict(drive.DriveLetter) = ""
    Next
    'Check drive letters C: to Z: for two free adjacent drive letters and set the "driveLetter" variable to the first one.
    For i = Asc(driveLetter) To Asc("Z")
    If Not drivesDict.Exists(Chr(i)) And Not drivesDict.Exists(Chr(i + 1)) Then
    driveLetter = Chr(i)
    Exit For
    End If
    Next
    'If two free adjacent drive letters were not found then exit.
    If driveLetter = "" Then
    Exit Function
    End If
    adjacentDrives = Array(driveLetter, Chr(Asc(driveLetter) + 1))
    GetFreeDrives = True
    End Function
    'Name : NewDictionary -> Creates a new dictionary object.
    'Parameters : None ->
    'Return : NewDictionary -> Returns a dictionary object.
    Function NewDictionary
    Dim dict
    Set dict = CreateObject("scripting.Dictionary")
    dict.CompareMode = vbTextCompare
    Set NewDictionary = dict
    End Function

  • How can I add three binary numbers and then convert to string (Hex format)?

    Hi All,
    I have my problem "half" resolved, but need some assistance on the final piece.  Overall, I need to take three string values (hex format), convert them to binary, add them and then convert back to a string (hex format).  If that doesn't make sense maybe this will:
    Final Result (My target) = 0xCC
     = 0x03 + 0x01 + 0x04
              = 0x03; 0011b
              = 0x01; 0001b
              = 0x04; 0100b
    For my app, we are dropping "masking" some of the bits so that we get 1 byte:
              = 0x03; 11b
              = 0x01; 001b
              = 0x04; 100b
    So...
    11001100b = 0xCC
    In my VI, I am taking each initial string [0x03,0x01 and 0x04] type casting them to U8.  Next I need to "mask" the binary values as shown above and then add them.  I am not sure how to do this in LV??
    Thanks for the help,
    Bryan

    Hi Bryan,
    there's a conversion palette in the string palette, ever looked at those functions?
    The rest is pure simple math:
    It's the straight-forward way, there are other possibilities too!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Multi mapping before BPM and then message routing to different IDocs

    I am working on PI 7.0.
    I have a scenario where a message from a third party needs to be split and then mapped to multiple IDocs in the target. This decision happens based on an RFC call to SAP ECC. Before the message passes to BPM, I have done a multi mapping to make the RFC call and split the message into multiple messages. Subsequently I have taken a multi line container inside the BPM to receive these messages and process them Parforeach and then a switch is applied to handle the rest of the scenario.
    Problem is when I am trying to execute the scenario, it fails in first step(multi mapping) before the BPM, it is not able to create the node for the multiple message.
    To explain a bit more, Message type say M1 is linked to Message interface MI1_OB. Then I have created an abstract message interface MI1_ABS and made it as 0---unbounded. Similarly in the message mapping I have changed the occurrence of the target message type (same as source message type)

    Hi Ambrish Mishra,
    Please check "Performing Several Multi-Mappings in a Series" [Link|http://help.sap.com/saphelp_nwpi711/helpdata/en/21/6faf35c2d74295a3cb97f6f3ccf43c/frameset.htm] . According it, second mapping should be able to accept this structure as input
    <?xml version="1.0" encoding="UTF-8"?>
    <sm:Messages xmlns:sm="http://sap.com/xi/XI/SplitAndMerge">
      <Message1>
      </Message1>
      <MessageN>
      </MessageN>
    </sm:Messages>
    Regards,
    Raghu_Vamsee

  • How to Split the string using Substr and instr using loop condition

    Hi every body,
    I have below requirement.
    I need to split the string and append with single quotes('') followed by , (comma) and reassign entire values into another variable. so that i can use it where clause of update statement
    for example I am reciveing value as follows
    ALN varchar2(2000):=(12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434);
    Note: In the above variable i see 8 transactions, where as in real scenario i donot how many transaction i may recive.
    after modification i need above transactions should in below format
    ALTR Varchar2(2000):=('12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434');
    kindly help how to use substr and instr in normal loop or for loop or while loop while modifying the above transactions.
    Please help me to sort out this issue.
    Many Thanks.
    Edited by: user627525 on Dec 15, 2011 11:49 AM

    Try this - may not be the best way but...:
    create or replace type myTableType as table of varchar2(255)
    declare
    v_array mytabletype;
    v_new_str varchar2(4000);
    function str2tbl
             (p_str   in varchar2,
              p_delim in varchar2 default '.')
             return      myTableType
        as
            l_str        long default p_str || p_delim;
             l_n        number;
             l_data     myTableType := myTabletype();
        begin
            loop
                l_n := instr( l_str, p_delim );
                exit when (nvl(l_n,0) = 0);
                l_data.extend;
                l_data( l_data.count ) := ltrim(rtrim(substr(l_str,1,l_n-1)));
                l_str := substr( l_str, l_n+length(p_delim) );
            end loop;
            return l_data;
       end;
    begin
      v_array := str2tbl ('12ERE-3MT-4Y,4IT-5O-SD,OP-K5-456,P04-SFS9-098,90P-SSF-334,3434-KJ4-O28,AS3-SFS0-J33,989-3KL-3434', ',');
          FOR i IN 1 .. v_array.COUNT LOOP
             v_new_str := v_new_str || ''''||v_array(i)||'''' || ',';
          END LOOP;
       dbms_output.put_line(RTRIM(v_new_str, ','));
    end;  
    OUTPUT:
    =======
    '12ERE-3MT-4Y','4IT-5O-SD','OP-K5-456','P04-SFS9-098','90P-SSF-334','3434-KJ4-O28','AS3-SFS0-J33','989-3KL-3434'HTH
    Edited by: user130038 on Dec 15, 2011 12:11 PM

  • Converting from spreadshet string to array and then back to spreadsheet string

    My questions is; why is the Spreadsheet string to array function creating more data than the original string had when you change the array back into a spreadsheet string. Im trying to analyze a comma delimited file using array functions since my column and row size is constant, but my data varies. Thus my reason for not using string parsing functions which would get more involved and difficult. So, however, after i convert to a 2D array of data from the comma delimited file I read from, and then I convert back to string using the Array to Spreadsheet String, I get added columns to the file, which prevents another program from receiving these files. Also, the data which I am reading is not all contiguous, it has gaps in some places for empty data. Looking at the file compared to the original after it has gone from string to array and then back to string again, looks almost identical except for the file size which got larger by 400 bytes and where the original file has empty spaces, the new file has a lot of commas added. Any idea?
    Charles

    The result you get is normal when the spreadsheet string contains rows of uneven length. Since the array rows have the same number of elements, nil values are added during the coonversion. And of course, the back to string conversion keep those added values in the string, with the associated commas.
    example : 3 x 3 array
    1,2,3
    4
    5,6,7
    is converted into
    1 2 3
    4 0 0
    5 6 7
    then back to
    1,2,3
    4,0,0
    5,6,7
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • Convert string to datetime and then use in a where clause

    I am trying to pull in warranty expiry dates that have been entered as strings and then perform a calculation as to which ones are expired, about to expire within
    90 days or will expire in more than 90 days. I have got the query to a point where I have converted it to a datetime field (though I'm sure I used the right value to just give me the date, its giving me date and time) and have it printing out the machine name
    and the warranty for that machine.
    SELECT
      machNameTab.machName
      ,convert(date,auditRsltManualFieldValues.fieldValue,103) AS warranty
    FROM
      machNameTab
      INNER JOIN auditRsltManualFieldValues
        ON machNameTab.agentGuid = auditRsltManualFieldValues.agentGuid
    WHERE
      machNameTab.groupName = N'root.company'
      AND auditRsltManualFieldValues.fieldNameFK = 958472722796011
    What I need to do next is change this so instead of just spitting out all the dates as 'Warranty', I want it to give me the fields 'Expired', 'Expiring' (expiry date is within 90 days of the current date) and 90Days (expiry date is over 90 days from the current
    date)

    SELECT
    machNameTab.machName
    ,convert(date,auditRsltManualFieldValues.fieldValue,103) AS warranty,
    select
    case
    when datediff(day,getdate(),convert(date,auditRsltManualFieldValues.fieldValue,103) )<90 then 'Expiring'
    when datediff(day,getdate(),convert(date,auditRsltManualFieldValues.fieldValue,103) )<0 then 'Expired'
    when datediff(day,getdate(),convert(date,auditRsltManualFieldValues.fieldValue,103) )>=90 then '90Days'
    end as status
    FROM
    machNameTab
    INNER JOIN auditRsltManualFieldValues
    ON machNameTab.agentGuid = auditRsltManualFieldValues.agentGuid
    WHERE
    machNameTab.groupName = N'root.company'
    AND auditRsltManualFieldValues.fieldNameFK = 958472722796011
    I added a case to your select. The case will output the strings you wanted based on the date.

  • Storing data in Array or StringBuffer and then comparing it to a string

    I want to store some data in a list or an Array (but apparently an Array only holds 10 items?) and then I want to be able to check if myString is equal to any of the posts in the array/list.
    Or if I use a StringBuffer I want to check to see if myString is part of the StringBuffer?
    How do I do this?
    / Elin

    I want to store some data in a list or an Array (but
    apparently an Array only holds 10 items?)Uh, no. Arrays can (theoretically) contain Integer.MAX_VALUE elements.
    and then I want to be able to check if myString is equal to any
    of the posts in the array/list.Don't confuse String's equals() method with the equality operator '=='. The == operator checks that two references refer to the same object. If you want to compare the contents of Strings (whether two strings contain the same character sequence), use equals(), e.g. if (str1.equals(str2))...
    Example:String s1 = "foo";
    String s2 = new String("foo");
    System.out.println("s1 == s2: " + (s1 == s2)); // false
    System.out.println("s1.equals(s2): " + (s1.equals(s2))); // trueFor more information, check out Comparison operators: equals() versus ==
    Or if I use a StringBuffer I want to check to see if
    myString is part of the StringBuffer?See above discussion on .equals().
    How do I do this?
    Here are some other resources to help you get started with Java.
    The Java&#153; Tutorial - A practical guide for programmers
    Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program
    New to Java Center
    How To Think Like A Computer Scientist
    Introduction to Computer Science using Java
    The Java Developers Almanac 1.4
    JavaRanch: a friendly place for Java greenhorns
    jGuru
    Bruce Eckel's Thinking in Java
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java

Maybe you are looking for

  • I need to be able to save a ps or indd file directly to my cloud.

    Ideally there would be a 'save to cloud' button or something like as part of the save menu. I can't find how to do thsi, so help appreciated. I can upload files to the cloud, but haven't found out how to save them directly from ps or indd. Thanks

  • My safari keeps dying for some weird reason and it gives me this message...

    When it dies, the message says "Safari quit unexpectedly while using the .AbsoluteVideoConverter.png plugin. Click Reopen to open the application again." I'm not sure if its some kind of extension or what... I'm helpless! I'd really appreciate any ki

  • Result Caching in OSB

    We are planning to implement OSB result caching feature in our project.We did the following to do a POC. 1.Created a DBAdapter to select from a table and created a BS out of that. 2.Enabled Result caching with TTL for 5 mins. 3.Invoked the BS from a

  • Table Updates and TableCellEditors

    This has probably been asked before but nonetheless I have a Table in a GUI that is instantiated from a model with data taken from a database. Everything is OK except when adding a a row. I have a method that inserts a blank row at the end of the dat

  • PS Text: No Document Opened

    I've got a project that has a ps text stored in Microsoft Excel format and when I attempt to open the text for editing (using the "Function (edit ps text)" button, I'm getting the error "No Document Opened". I have other projects with similar ps text