Rocket U2 | UniVerse & UniData

 View Only
  • 1.  .NET & UniDynArray

    Posted 10-14-2024 05:40

    Hi All,

    I am exploring using UniDynArray.

    My Sample Code

                String xVM = Convert.ToChar(253).ToString();
                string inS = "H1" + xVM + "H2" + xVM + "H3";
                U2.Data.Client.UO.UniSession ses = U2.Data.Client.UO.UniSession.NullSession(null,Encoding.Unicode);
    
                var dynArray = ses.CreateUniDynArray(inS);
    
                var s = dynArray.ToString();
                
                MessageBox.Show(dynArray.Extract(1, 1).StringValue);
                MessageBox.Show(dynArray.Extract(1, 2).StringValue);
    

    Issue:

    My first MessageBox is correct, but the 2nd one is showing me some rubbish..



    ------------------------------
    Koon MIng Fong
    Mr
    P & O Global Technologies SDN. BHD.
    KUALA LUMPUR MY
    ------------------------------


  • 2.  RE: .NET & UniDynArray

    Posted 10-30-2024 21:23

    Any help here ?



    ------------------------------
    Koon MIng Fong
    Mr
    P & O Global Technologies SDN. BHD.
    KUALA LUMPUR MY
    ------------------------------



  • 3.  RE: .NET & UniDynArray

    Posted 10-31-2024 09:32

    Hi, what version of Visual Studio are you using?



    ------------------------------
    Sergio Perin
    Ing.
    Self Registered
    Buenos Aires AR
    ------------------------------



  • 4.  RE: .NET & UniDynArray

    Posted 10-31-2024 10:10

    UniDynArray dynArray = new UniDynArray(ses,"H1"+xVM+"H2"+xVM+"H3");
    MessageBox.Show(dynArray.Extract(1, 1).StringValue);
    MessageBox.Show(dynArray.Extract(1, 2).StringValue);
    MessageBox.Show(dynArray.Extract(1, 3).StringValue);



    ------------------------------
    Phillip Potter
    V.P. R&D
    Data Management Associates Inc DMA
    Cincinnati OH US
    ------------------------------



  • 5.  RE: .NET & UniDynArray

    Posted 10-31-2024 11:27

    The problem is when you create the session you are specifying a Unicode map.

    The VM is a Unicode leader character (utf8 and utf16) which mangles the following string - if you look at the byte array underneath the dynarray you will see that it has added a \0 for each one, so presumably that works for the first value (scans to the first 253) and then screws up the following as the next byte is a zero.

    Always problems with mapping between UniVerse marker characters and Unicode.

    Change to:

    var ses = U2.Data.Client.UO.UniSession.NullSession(null); 

    and it will show the correct result.



    ------------------------------
    Brian Leach
    Director
    Brian Leach Consulting
    Chipping Norton GB
    ------------------------------



  • 6.  RE: .NET & UniDynArray

    Posted 11-02-2024 11:15

    Hi I tried..its not showing any rubbish..but the result is NOT correct.

    The first msg box

    The 2nd msg box


    ------------------------------
    Koon MIng Fong
    Mr
    P & O Global Technologies SDN. BHD.
    KUALA LUMPUR MY
    ------------------------------