How to get numeric result from 'search and replace' string function

hii
i am using search and replace function to get output.my output is of form ' *X0123.3 ' .here i am replacing the term *X01 with space because i need only 23.3 as a result.but i am unable to get that out in the output indicator.i used lot of functions like string to number and so on but i am getting output as zero .can you please suggest me wt to do.i am attaching a copy of my file.
Attachments:
Untitled 1.vi ‏25 KB

Your problem is the fact that you are converting it to an integer, thus loosing the fractional part. You need to use "Fract/Exp String To Number" instead and create a DBL so yor data is 23.3 instead of 23.
You also don't need to manipulate the string if the initial part is of constant lenght. Just use the offset input as in the figure below.
Message Edited by altenbach on 07-31-2006 07:02 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
ToDBL.png ‏2 KB

Similar Messages

  • Search and replace string function

    Hello, I am using the "search and replace string" function and it does nt seem to work consistently for me.   I am using it in a situation where I am taking an array of strings, converting this into a spreadsheet string then deleting all of the commas.  Has anyone experienced the same behavior? I have searched through other posts and found other simular faults but none of the fixes worked for this. I can post the code it needed.
    Thanks,
    Andrew

    I agree that commas are often not desirable, especially if your software should also work in countries where comma is used as a decimal seperator.
    Where are the commas coming from? Does (1) each element of the original array have one (or more), do you (2) use comma as seperator if you convert it to a spreadhseet string?
    For (1), you might just strip out the comma for each element right in the loop. For case (2) you would simply use a different separator to begin with, of course.
    Btw: you are abusing a WHILE loop as a FOR loop, because you have a fixed number of iterations. Please replace it with a FOR loop. If you use a FOR loop, LabVIEW can manage memory much more efficiently, because it can allocate the entire output array before the loop starts. For While loops, the total number of iterations is not known to the compiler. (Of course a real program would also stop the loop if an error occurs. In this case you would need to stay woth the WHILE loop. )
    Do you have a simple example how the raw array elements look like. How many commas are there?
    LabVIEW Champion . Do more with less code and in less time .

  • Search and Replace String Function replaces line feeds when I only want spaces replaced?

    I need to replace every instance of a space or series of spaces in a multi line string with commas (or tabs) so I can dump it into a spreadsheet.
    I am using the regular expresion [\s]+ and it works but it is also replacing the end of lines (\r\n) too.
    How can I make it replace the spaces but leave teh end of lines intact?
    Solved!
    Go to Solution.
    Attachments:
    replace.vi ‏6 KB

    Right click on the search string and change it to '\' Code Display. Enter the space character (\s) correctly - you've got \\s right now.

  • Search and replace string formatting

    Hi,
    I am trying to do a search and replace formatting of a string.
    In the example I am looking for string "PASSED" but it must also start with usbflash and some number + PASSED.
    I can't get the format to have a number from 1-99. The number of replacements should add up to 6 in this case. I have tried with \d for any number, and I also tried [1-99].
    Solved!
    Go to Solution.

    Right click on the Search And Replace String function.  There is an option to use Regular Expressions.  Then give this a try.
    EDIT: You will need to set the Replace All input to TRUE.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    Match Pattern.png ‏12 KB

  • Search and replace string problems

    Hi to all,
    I have problem with Search and replace string function. It shows me a wrong Value (Number) from 15 to 100 is everything OK (15=0, 30=1, 45=2, 100=3), but after 100 ........
    Take look in VI and if you have any ideas post them please
    THX
    Igor 
    Attachments:
    indexing.vi ‏10 KB

    there will be no 15115 string, but 15 or 115 and 15 is 0, 115 is 4. Anyway, i have changed string input format and now its working THX for your help
    Attachments:
    indexing.vi ‏10 KB

  • Search and replace strings in a file while ignoring substrings

    Hi:
    I have a java program that searches and replaces strings in a file. It makes a new copy of the file, searches for a string in the copy, replaces the string and renames the new copy to the original file, thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but searching for "Topabcd" and replacing it doesnot work because there is a match for "abcd" in a different search scenario. How can I modify the code such that if "abcd" is already searched and replaced then it should not be searched for again or rather search for "abcd" as entire string and not if its a substring of another string.
    In the below code output, all instances of "abcd" and the ones of "Topabcd" are replaced by ABCDEFG and TopABCDEF respectively, whereas according to the desired output, "abcd" should be replaced by ABCDEFG and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
              String find_productstring = "abcd";
              String replacement_productstring = "ABCDEFG";
              compsXml = new FileReader(compsLoc);
              compsConfigFile = new BufferedReader(compsXml);
              File compsFile =new File("file.xml");
              File compsNewFile =new File("file1.xml");
              BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
              while ((compsLine = compsConfigFile.readLine()) != null)
                    new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
                    out.write(new_compsLine);
                    out.write("\n");
                out.close();
                compsConfigFile.close();
                compsFile.delete();
                compsNewFile.renameTo(compsFile);
            catch (IOException e)
            //since "Topabcd" contains "abcd", which is the search above and hence the string "Topabcd" is not replaced correctly
             try
                   String find_producttopstring = "Topabcd";
                   String replacement_producttopstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
                   compsConfigFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
                   BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
                   while ((compsLine = compsConfigFile.readLine()) != null)
                         new_compsLine =compsLine.replaceFirst(find_producttopstring, replacement_producttopstring);
                         out.write(new_compsLine);
                         out.write("\n");
                     out.close();
                     compsConfigFile.close();
                     compsFile.delete();
                     compsNewFile.renameTo(compsFile);
                 catch (IOException e)
            }Thanks a lot!

    Hi:
    I have a java program that searches and replaces
    strings in a file. It makes a new copy of the file,
    searches for a string in the copy, replaces the
    string and renames the new copy to the original file,
    thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but
    searching for "Topabcd" and replacing it doesnot work
    because there is a match for "abcd" in a different
    search scenario. How can I modify the code such that
    if "abcd" is already searched and replaced then it
    should not be searched for again or rather search for
    "abcd" as entire string and not if its a substring of
    another string.
    In the below code output, all instances of "abcd" and
    the ones of "Topabcd" are replaced by ABCDEFG and
    TopABCDEF respectively, whereas according to the
    desired output, "abcd" should be replaced by ABCDEFG
    and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
    String find_productstring = "abcd";
    String replacement_productstring = "ABCDEFG";
    compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    BufferedReader(compsXml);
    File compsFile =new File("file.xml");
    File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    FileWriter("file1.xml"));
    while ((compsLine =
    compsConfigFile.readLine()) != null)
    new_compsLine
    =compsLine.replaceFirst(find_productstring,
    replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
    catch (IOException e)
    //since "Topabcd" contains "abcd", which is
    the search above and hence the string "Topabcd" is
    not replaced correctly
    try
                   String find_producttopstring = "Topabcd";
    String replacement_producttopstring =
    topstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    gFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    dWriter(new FileWriter("file1.xml"));
    while ((compsLine =
    compsLine = compsConfigFile.readLine()) != null)
    new_compsLine
    new_compsLine
    =compsLine.replaceFirst(find_producttopstring,
    replacement_producttopstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
                 catch (IOException e)
    Thanks a lot!I tried the matches(...) method but it doesnt seem to work.
    while ((compsLine = compsConfigFile.readLine()) != null)
    if(compsLine.matches(find_productstring))
         System.out.println("Exact match is found for abcd");
         new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
         else
         System.out.println("Exact match is not found for abcd");
         out.write(compsLine);
         out.write("\n");

  • Search and Replace String throwing the wrong error message with regexp?

    This came up in a LAVA thread, and I'm not sure if there's a bug here or not. When using Search and Replace string, and using a regular expression of [(G[b|i])], LabVIEW throws error -4622, "There is an unmatched parenthesis in a regular expression."  There are obviously no unmatched parenthesis in that expression, so it seems to me that the wrong error is being thrown. I'm just not sure if that's a syntactically valid regexp. The problem seems to be with nesting [ ]'s inside ( )'s inside [ ]'s. I've tried a couple of regexp resources on the Web, and one suggests it's valid, while the other seems to think it isn't.
    Message Edited by eaolson on 03-13-2007 10:33 AM
    Attachments:
    ATML_StandardUnit2.vi ‏10 KB
    regexp.png ‏5 KB

    adambrewster wrote:
    I think your regexp is invalid.
    In regexps, brackets are not the same as parentheses.  Parens are for grouping, while brackets are for matching one of a class of characters.  Brackets can not be nested.
    If the regexp is replaced with [G[bi]], there is no error, so it's not a matter of nested brackets. I couldn't find anything on the PCRE man page that forbids nested brackets specifically, but it makes sense.
    Your expression "[(G[bi])]", therefore parses as a character class which matches '(', 'G', '[', 'b', or 'i' followed by an unmatched paren, and an unmatched bracket.
    I don't believe that's the case. Replace the regexp with [(Gbi)], and the error goes away. So it's not a matter of the '(' being literal, and then encountering a ')' without a matching '('.
    daveTW wrote:
    what string exactly you want to replace? I think the round braces are not right in this case, since they mark partial matches which are given back by "match regular expression". But you don't want to extract parts of the string, you want to replace them (or delete, with empty <replace string>). So if you leave the outer [( ... )] then your RegEx means all strings with either "Gb" or "Gi".
    It's not my regular expression. A poster at LAVA was having problems with one of his (a truly frightening one), and this seemed to be the element that was causing the problem. I'm pretty sure that the originator of the regexp meant to use G(b|i), which seems like a complicated way of matching "Gb" or "Gi", if you ask me.

  • How to get a parameter from BPC and use it in ABAP program

    Hello gurus!
    I got a problem...
    SAP BPC will send parameters such as year, division, category, company code and so on via script logic to SAP BW.
    I need to get these parameters from BPC and use them in a ABAP program as a filter.
    This ABAP program will do several routines and return new values to BPC. It must be made on ABAP and I need to filter data to avoid performance issues.
    Does anybody knows how to do it? or have a example of it?
    Thank you in advance.
    Regards,
    Rubens Kumori

    Hello, I'm looking for a suggest.
    I need to pass two parameters (users can input them in a data manager package in bpc) to a BAdI.
    In this BAdI I write a code that store those parameters in a InfoObject.
    The problem is:
    - one parameter is for CATEGORY value. CATEGORY is a dimension of the application and I read the value with a code like this:
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = 'C_CATEGORY'.
    - other parameter is a generic DATE. this parameter is not a dimension of the application and I don't know how I can retrieve this value in BAdI.
          READ TABLE it_cv INTO l_s_it_cv
               WITH TABLE KEY dim_upper_case = '.....'.
    The data manager dynamic script is:
    PROMPT(SELECTINPUT,,,,"%CATEGORY_DIM%")
    PROMPT(TEXT,%SELECTED_DAY%,"Write the date (format YYYYMMDD)",)
    I also have a dynamic constant that assign the name %CATEGORY_DIM% to "C_CATEGORY" value.
    Can anyone help me?
    thanks a lot
    Edited by: Luca Novali on Feb 13, 2012 3:49 PM

  • Get numerical values from 2D array of string

    Hello! 
    I start by saying that I have a base knowledge of LabView. I'm using LabView 2011. I'm doing some communications test via Can-Bus protocol. As you can see in pictures of the block diagram and of the front panel that I've attached I'm using "Transmit Receive same Port" LabView example. It works very good but I would need to insert the 8 data bytes that I receive from the server in 8 different numerical variables so that I could use them to make some operations. How can I get numerical values from the 2D array of string that I attached? 
    Every example that you can provide is important! 
    Thank you very much! 
    Attachments:
    1.jpg ‏69 KB
    2.jpg ‏149 KB

    Hi martiflix,
    ehm: to unbundle data from a cluster I would use the function Unbundle(ByName)…
    When you are new to LabVIEW you should take all the FREE online resources offered by NI on their website!
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Using a variable in a Powershell search and replace string

    Hi
    a couple of days ago I posted a question about doing a search and replace with wildcards
    Search and repalce with Widcards
    I got a swift and very helpful answer but now I need to build on it.
    In a text file I wanted to replace all the text between two defined words.  the script I got was this
    $text = 'Some Server this bit of text varies Language stuff'
    $text -replace '(.*Server) .+? (Language.*)','$1 it will always say this $2'
    It works great but now I want to replace "it will always say this" with a variable and I can't figure out the correct grammar to make this happen.
    Can anyone help??
    Thanks
    Alex

    Here's one way:
    $replace = 'it will aways say this'if ( $text -match '(.*Server) .+? (Language.*)' )
    { "{0} $Replace {1}" -f $matches[1,2] }
    else { $text }
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to get Date value from database and display them in a drop down list?

    Hello.
    In my Customers table, I have a column with Date data type. I want to create a form in JSP, where visitors can filter Customers list by year and month.
    All I know is this piece of SQL that is convert the date to the dd-mm-yyyy format:
    SELECT TO_CHAR(reg_date,'dd-mm-yyyy') from CustomersAny ideas of how this filtering possible? In my effort not to sound like a newbie wanting to be spoonfed, you can provide me link to external notes and resources, I'll really appreciate it.
    Thanks,
    Rightbrainer.

    Hi
    What part is your biggest problem?? I am not experienced in getting data out of a database, but the way to get a variable amount of data to show in a drop down menu, i have just messed around with for some time and heres how i solved it... In my app, what i needed was, a initial empty drop down list, and then using input from a text-field, users could add elements to a Vector that was passed to a JComboBox. Heres how.
    package jcombobox;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.Vector;
    import javax.swing.*;
    public class Main extends JApplet implements ActionListener {
        private Vector<SomeClass> list = new Vector<SomeClass>();
        private JComboBox dropDownList = new JComboBox(list);
        private JButton addButton = new JButton("add");
        private JButton remove = new JButton("remove");
        private JTextField input = new JTextField(10);
        private JPanel buttons = new JPanel();
        public Main() {
            addButton.addActionListener(this);
            remove.addActionListener(this);
            input.addActionListener(this);
            buttons.setLayout(new FlowLayout());
            buttons.add(addButton);
            buttons.add(remove);
            add(dropDownList, "North");
            add(input, "Center");
            add(buttons, "South");
        public void actionPerformed(ActionEvent e) {
            if (e.getSource() == addButton) {
                list.addElement(new SomeClass(input.getText()));
                input.setText("");
            } else if (e.getSource() == remove) {
                int selected = dropDownList.getSelectedIndex();
                dropDownList.removeItemAt(selected);
        public void init(String[] args) {
            setSize(400,300);
            getContentPane().setLayout(new BorderLayout());
            getContentPane().add(new Main());
    }And that "SomeClass" is show here
    package jcombobox;
    public class SomeClass {
        private String text;
        public SomeClass(String input) {
            text = input;
        public String toString() {
            return text;
    }One of the things i struggled a lot with was to get the dropdown menu to show some usefull result. If the list just contains class references it will show the memory code that points to that class. Thats where the toString cones in handy. But it took me some time to figure that one out, a laugh here is welcome as it should have been obvious :-)
    When the app is as simple as this one, using a <String> vector would have been easier, but this is just to demonstrate how to place classes in a vector and get some usefull info out of it, hope this answered some of your question :-)
    The layout might have been easier to write, than using the toppanel created by the JApplet and then the two additional JPanels, but it was just a small app brewed together in 15 minutes. Please comments on my faults, so that i can learn of it.
    If you need any of the code specified more, please let me know. Ill be glad to,

  • How to get save result from EXECUTE from a dynamic SQL query in another table?

    Hi everyone, 
    I have this query:
    declare @query varchar(max) = ''
    declare @par varchar(10)
    SELECT @par = col1 FROM Set
    declare @region varchar(50)
    SELECT @region = Region FROM Customer
    declare @key int
    SELECT @key = CustomerKey FROM Customer
    SET @query = 'SELECT CustomerKey FROM Customer where ' + @par + ' = '+ @key+ ' '
    EXECUTE (@query)
    With this query I want get col1 from SET and compare it to the column Region from Customer. I would like to get the matching CustomerKey for it.
    After execution it says commands are executed successfully. But I want to save the result from @query in another table. I looked it up and most people say to use sp_executesql. I tried a few constructions as sampled and I would always get this error: 
    Msg 214, Level 16, State 2, Procedure sp_executesql, Line 12
    Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.
    So the output should be a list of CustomerKeys in another table.
    How can I save the results from EXECUTE into a variable? Then I assume I can INSERT INTO - SELECT in another table. 
    Thanks

    CREATE TABLE Customer
    (CustomerKey INT , Name NVARCHAR(100));
    GO
    INSERT dbo.Customer
    VALUES ( 1, N'Sam' )
    GO
    DECLARE @query nvarchar(max) = ''
    declare @par varchar(10) = 'Name',
    @key varchar(10) = 'Sam'
    CREATE TABLE #temp ( CustomerKey INT );
    SET @query =
    insert #temp
    SELECT CustomerKey
    FROM Customer
    where ' + @par + ' = '''+ @key+ ''' '
    PRINT @query
    EXEC sp_executesql @query
    SELECT *
    FROM #temp
    DROP TABLE #temp;
    DROP TABLE dbo.Customer
    Cheers,
    Saeid Hasani
    Database Consultant
    Please feel free to contact me at [email protected] as well as on Twitter and Facebook.
    [My Writings on TechNet Wiki] [T-SQL Blog] [Curah!]
    [Twitter] [Facebook] [Email]

  • How to get accurate results from sql code ?

    Hello everybody,
    I have a problem with some portion of my code.
    I get more results than I specify in the where clause.
    Here is the sample code:
    c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
    and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
    For some reason I also get the following results back:
    110-6910-51001-001, and 110-6910-51003-001 But I don't need the 51001 and 51003. How do I specify in sql what range I really want. I was sure that the code above is correct. I guess not.
    I would appreciate any help,
    Thanks,
    Sonya

    Have you tried using the query either of the following...
    1) c.gl_acct_id between '110-6890-69000-000'
    and '110-7000-67999-999'
    and c.gl_acct_id not like '110-6910-51001-%'
    and c.gl_acct_id not like '110-6910-51003-%'
    assuming you have only 3 digits at the end of gl_acct.
    2)If you know that your acct_id belongs to only 69000 or 67999
    then
    (c.gl_acct_id LIKE '110-6890-69000-%' OR
    c.gl_acct_id LIKE '110-7000-67999-%' )
    Plz. let me know if this not what you are looking for.
    thanx
    rajkiran
    Here is the whole script:
    select distinct c.gl_acct_id acct_no,
    c.gl_acct_desc,
    min(a.local_act_beg_bal) local_act_beg_bal,
    sum(b.local_act_mtd_dr_amt) debits,
    sum(b.local_act_mtd_cr_amt) credits,
    nvl(min(a.local_act_beg_bal),0)+sum(nvl(b.local_act_mtd_dr_amt,0))-
    sum(nvl(b.local_act_mtd_cr_amt,0)) end_bal
    from gl_acct c, gl_acct_bal a, gl_acct_bal b
    where c.org_unit_id = '110'
    and b.gl_acct_id = c.gl_acct_id
    and a.gl_acct_id = c.gl_acct_id
    and c.sum_det_ind = 'D'
    and c.gl_acct_class_ind in ( 'A' , 'L' , 'Q' , 'I' , 'E' )
    and a.year_no = '2001'--:loyear
    and a.period_no = '1'--:loperiod
    and ( ( b.year_no = '2001'--:hiyear
    and b.period_no between '1'--:loperiod
    and'13')-- :hiperiod
    and c.gl_acct_id between '110'||'-'||'6890'||'-'||'69000'||'-'||'%'
    and '110'||'-'||'7000'||'-'||'67999'||'-'||'%'
    group by c.gl_acct_id, c.gl_acct_desc
    I want to have ability to specify ranges for gl_accoount.
    Thanks,
    Sonya

  • How to get table result from XML

    Hi I am new to XML, I was playing with node, but wasn't successfull
    I have XML fragment
    DECLARE @XML xml =
    <E1EDP01 SEGMENT="1">
    <E1EDP19 SEGMENT="1">
    <QUALF>002</QUALF>
    <IDTNR>A1</IDTNR>
    <KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
    </E1EDP19>
    <E1EDP19 SEGMENT="1">
    <QUALF>003</QUALF>
    <IDTNR>E1</IDTNR>
    </E1EDP19>
    </E1EDP01>
    <E1EDP01 SEGMENT="1">
    <E1EDP19 SEGMENT="1">
    <QUALF>002</QUALF>
    <IDTNR>A2</IDTNR>
    <KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
    </E1EDP19>
    <E1EDP19 SEGMENT="1">
    <QUALF>003</QUALF>
    <IDTNR>E2</IDTNR>
    </E1EDP19>
    </E1EDP01>
    <E1EDP01 SEGMENT="1">
    <E1EDP19 SEGMENT="1">
    <QUALF>002</QUALF>
    <IDTNR>A3</IDTNR>
    <KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
    </E1EDP19>
    <E1EDP19 SEGMENT="1">
    <QUALF>003</QUALF>
    <IDTNR>E3</IDTNR>
    </E1EDP19>
    </E1EDP01>'
    and I need to create query, which list all products and his two codes, result should be like this
    ProductCode1
    ProductCode2
    A1
    E1
    A2
    E2
    A3
    E3
    It is visible from XML fragment, how those values are organised in segments......
    I tried to use
    select PC1.query('./text()')
    AS PC1,
    PC2.query('./text()')
    AS PC2
    from @XML.nodes('/E1EDP01/E1EDP19[1]/IDTNR') as PC1(PC1)
    CROSS APPLY @XML.nodes('/E1EDP01/E1EDP19[2]/IDTNR') as PC2(PC2)
    But it gets all combinations of ProductCode1 and PRoductCode2, somtehing like cross join and result has 9 rows...
    Could you help please

    Try this,
    DECLARE @XML xml ='
    <E1EDP01 SEGMENT="1">
    <E1EDP19 SEGMENT="1">
    <QUALF>002</QUALF>
    <IDTNR>A1</IDTNR>
    <KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
    </E1EDP19>
    <E1EDP19 SEGMENT="1">
    <QUALF>003</QUALF>
    <IDTNR>E1</IDTNR>
    </E1EDP19>
    </E1EDP01>
    <E1EDP01 SEGMENT="1">
    <E1EDP19 SEGMENT="1">
    <QUALF>002</QUALF>
    <IDTNR>A2</IDTNR>
    <KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
    </E1EDP19>
    <E1EDP19 SEGMENT="1">
    <QUALF>003</QUALF>
    <IDTNR>E2</IDTNR>
    </E1EDP19>
    </E1EDP01>
    <E1EDP01 SEGMENT="1">
    <E1EDP19 SEGMENT="1">
    <QUALF>002</QUALF>
    <IDTNR>A3</IDTNR>
    <KTEXT>PRF NUDE MAGIQUE BB MEDIUM M-UP TST</KTEXT>
    </E1EDP19>
    <E1EDP19 SEGMENT="1">
    <QUALF>003</QUALF>
    <IDTNR>E3</IDTNR>
    </E1EDP19>
    </E1EDP01>'
    SET @XML = '<ROOT>' + CAST(@XML AS NVARCHAR(MAX)) + '</ROOT>'
    SET @XML = CAST(@XML AS XML)
    ;WITH CTE AS (
    select t.u.value ('QUALF[1]','varchar(10)') as QUALF,
    t.u.value ('IDTNR[1]','varchar(30)') as IDTNR,
    t.u.value ('KTEXT[1]','varchar(30)') as KTEXT,
    t.u.value ('..','varchar(30)') as DESCR
    from @XML.nodes('/ROOT/E1EDP01/E1EDP19') t(u)
    SELECT [002] AS ProductCode1,[003] AS ProductCode2 FROM (SELECT QUALF,IDTNR,DESCR FROM CTE) X
    PIVOT(MAX(IDTNR) FOR QUALF IN ([002],[003])) PVT
    Regards, RSingh

  • Q. How to get multiple results from a single column in a recordset using PHP

    Hi everyone
    Hope someone can help. I have a column called categories and about 5 categories listed. I want to show all products that are listed in say 2 categories. I only have basic php skills so only know how to pass a url value to show the products from 1 category e.g. 
    Select *
    FROM product
    WHERE category = colname
    $colname = $_GET['category'];
    URL...page.php?category=fruit
    Questions is how do I get the products from multiple categories to show e.g. all products from categories 'fruit', 'dairy', 'meat'
    Your help will be much appreciated as I am getting tired of beating my head against the wall. (should invent a PHP wall pillow and sell it online)
    Thanks

    $colname1 = $_GET['category1'];
    $colname2 = $_GET['category2'];
    $colname3 = $_GET['category3'];
    Select *
    FROM product
    WHERE category IN  ('$colname1', '$colname2', '$colname3')
    >Your help will be much appreciated as I am getting tired of beating my head against the wall
    My guess is that you are trying to build a web application without having first learned the basics on PHP and SQL. That's certainly the hard way.

Maybe you are looking for