Data Replication 2
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Retrieving Chapters

  1. #1
    Kevin is offline Junior Member
    Join Date
    Nov 2006
    Posts
    4
    Rep Power
    0

    Retrieving Chapters

    I am currently trying to figure out how to get chapters.
    I have a field that is an array in RMS, a virtual table exists for this array
    and I would like to get the chapter for it.

    In vb6 this would have been

    adoChildRecordset=adoRecordset.Field("Field").Valu e

  2. #2
    Yossi Shitrit is offline US Technical Team
    Join Date
    Sep 2006
    Posts
    38
    Rep Power
    0
    Hi Kevin,

    This is exactly how you would get the chapter using ADO and Attunity OLEDB provider.

    How are you trying to get the chapter? What interface are you using? Can you provide more information?

    Thanks,
    Yossi
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  3. #3
    Costi Zaboura is offline World Wide Support Manager
    Join Date
    Aug 2006
    Posts
    300
    Rep Power
    14

    ADO and Chapters

    Hi Kevin

    Can you pls review the following example and let me know if that helps---

    'Const ATTUNITY As String = "Provider=AttunityConnect;bindURL=alpha;
    OneTdpMode=1;DefTdpName=RMS;"

    Dim adoConn As New ADODB.Connection
    Dim adoRs As New ADODB.Recordset
    Dim adoItms As ADODB.Recordset
    Dim strSqlAtt As String
    adoConn.Provider = "AttunityConnect"
    adoConn.ConnectionString = "bindUrl=Alpha"
    adoConn.Open
    adoConn.DefaultDatabase = "RMS"
    strSqlAtt = "select emp_id ,{select age from emp_struct_hchild where _parent=hchild } as age from emp_struct"
    adoRs.Open strSqlAtt, adoConn, adOpenKeyset, adLockOptimistic
    Do Until adoRs.EOF
    If adoRs("age").Attributes = adFldIsChapter Then
    Set adoItms = adoRs("age").Value
    MsgBox adoRs("emp_id")
    End If
    adoRs.MoveNext
    Loop
    adoRs.Close
    adoConn.Close
    Set adoRs = Nothing
    Set adoConn = Nothing
    End Sub


    Notes -
    RMS is just a datasource name
    Alpha - is just a name of the machine where the RMS datasource resides
    The emp_struct is just an example that has arrays in it and can look as follows:

    ?xml version='1.0' encoding='ISO-8859-1'?
    navobj version='5.0.0.0'
    table name='EMP_STRUCT' datasource='rms'
    fileName='DKA300:[USER.xxx.RMS_DEMO]EMP_STRUCT.inx'
    recordForm='fixed' organization='index' nRows='4'

    fields
    field name='EMP_ID' description='EMPLOYEE ID' datatype='int4'/
    field name='CHILD_COUNTER' datatype='int4'/group name='HCHILD' dimension1='5' counterName='CHILD_COUNTER'
    fields
    field name='AGE' description='AGE' datatype='int4'/
    field name='NAME' description='NAME' datatype='string' size='10'/
    field name='SCHOOL_COUNTER' datatype='int4'/
    group name='HSCHOOL' dimension1='3' counterName='SCHOOL_COUNTER'
    fields
    field name='SCHOOL_NAME' description='SCHOOL NAME'
    datatype='string' size='10'/
    field name='SCHOOL_ADDRESS' description='SCHOOL ADDRESS'
    datatype='string' size='30'/
    /fields
    /group
    /fields
    /group
    field name='ADDRESS' description='HOME ADDRESS' datatype='string' size='30'/
    field name='SAL_COUNTER' datatype='int4'/
    group name='HSAL' dimension1='12' counterName='SAL_COUNTER'
    fields
    field name='MONTH' description='MONTH' datatype='string' size='3'/
    field name='BRUTTO' description='AMOUNT BRUTTO' datatype='dfloat'/
    field name='NETTO' description='AMOUNT NETTO' datatype='numstr_s'
    size='10' scale='2'/
    /fields
    /group
    /fields
    /table
    /navobj
    Last edited by Costi Zaboura; 11-10-2006 at 02:47 PM.
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  4. #4
    Kevin is offline Junior Member
    Join Date
    Nov 2006
    Posts
    4
    Rep Power
    0
    This is what I have so far in a VB.NET (vs2005) app, I already know how to do this in a vb6 environment.

    Dim MyDataSet AsNew Data.DataSet
    Using MyConnection AsNew Attunity.Data.AisClient.AisConnection("database=RMS;server=LEWIS;")
    Using MyDataAdapter AsNew Attunity.Data.AisClient.AisDataAdapter("SELECT * FROM SerBom WHERE ItemKey=' 21'", MyConnection)
    MyDataAdapter.Fill(MyDataSet,
    "SerBom")
    DataGridView1.DataSource = MyDataSet.Tables(
    "SerBom")

    'How do I access a chapter field


    EndUsing
    EndUsing
    Last edited by Kevin; 11-10-2006 at 03:42 PM.

  5. #5
    Kevin is offline Junior Member
    Join Date
    Nov 2006
    Posts
    4
    Rep Power
    0
    Here is a bit more info.
    A file called SERBOM resides on our Itanium (rms) and is made up of
    several array fields. One of these fields is "SERBUL". I need to access the
    chapter for it using Visual Studio 2005 (VB.NET)

    I cannot find any documentation on how to access chapters in this environment. I am hoping someone can shed some light on it.

  6. #6
    Yossi Shitrit is offline US Technical Team
    Join Date
    Sep 2006
    Posts
    38
    Rep Power
    0
    Hi Kevin,

    Try to use the AisDataReader for that.
    Once you get the DataReader object, use the GetValue(i) method with the ordinal of the chapter column.
    The output object you will get from GetValue() is actually another AisDataReader for that chapter.

    Thanks,
    Yossi
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  7. #7
    Kevin is offline Junior Member
    Join Date
    Nov 2006
    Posts
    4
    Rep Power
    0
    This is what I have, But it doesn't return any data for MyDataReader
    Is what I have correct?

    Dim MyDataReader As Attunity.Data.AisClient.AisDataReader
    Dim MySubReader As Attunity.Data.AisClient.AisDataReader
    Using MyConnection As New Attunity.Data.AisClient.AisConnection("database=RMS;server=LEWIS;")
    Using MyDataCommand As New Attunity.Data.AisClient.AisCommand("SELECT * FROM SerBom WHERE ItemKey=' 21'", MyConnection)
    MyConnection.Open()
    MyDataReader = MyDataCommand.ExecuteReader
    While MyDataReader.Read
    MySubReader = MyDataReader.GetValue(0)
    While MySubReader.Read
    Console.Write(MySubReader.Item("BUL").ToString)
    End While
    MySubReader.Close()
    End While
    MyDataReader.Close()
    MyConnection.Close()
    End Using
    End Using

  8. #8
    Yossi Shitrit is offline US Technical Team
    Join Date
    Sep 2006
    Posts
    38
    Rep Power
    0
    Hi Kevin,

    Here is a slightly modified code that should do the trick:

    Dim MyDataReader As Attunity.Data.AisClient.AisDataReader
    Dim MySubReader As Attunity.Data.AisClient.AisDataReader

    Using MyConnectionStringBuilder As New Attunity.Data.AisClient.AisConnectionStringBuilder("databa se=RMS;server=LEWIS")
    MyConnectionStringBuilder.DescribedResultset=True
    Using MyConnection As New Attunity.Data.AisClient.AisConnection(MyConnectionStringBu ilder.ConnectionString)

    Using MyDataCommand As New Attunity.Data.AisClient.AisCommand("SELECT * FROM SerBom WHERE ItemKey=' 21'", MyConnection)
    MyConnection.Open()

    MyDataReader = MyDataCommand.ExecuteReader
    While MyDataReader.Read
    MySubReader = MyDataReader.GetValue(0)
    While MySubReader.Read
    Console.Write(MySubReader.Item("BUL").ToString)
    End While
    MySubReader.Close()
    End While
    MyDataReader.Close()
    MyConnection.Close()
    End Using
    End Using
    EndUsing


    You need to set the DescribedResultset property to true in order to tell the AisClient to request a description of the server resultset. When the AisClient gets this description, it can determine if a resultset's column is a chapter or a blob.
    You must use the ConnectionStringBuilder to set the DescribedResultset property.

    Thanks,
    Yossi
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  9. #9
    Join Date
    Sep 2006
    Posts
    233
    Rep Power
    10
    If you are after modifying complex RMS data then you should also look at using the version 5.0 SQL XML features.

    If you enable XML support in the environment (Misc->exposeXmlField = True) then you can do something like:

    select xml from {table} where {some condition}
    The column returned would be the XML representation of the complete RMS record (as text). You can then edit this record and store it back with something like:

    update {table} set xml = ? where {same condition}
    This worked for some non-relational providers in version 4.8 and should work with all of them in 5.0.

    The benefit of this approach is that it significantly reduces the number of network roundtrips required to make a change.
    By Dror Harari

    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

  10. #10
    Yossi Shitrit is offline US Technical Team
    Join Date
    Sep 2006
    Posts
    38
    Rep Power
    0

    C# Version of the code

    Code:
    AisDataReader MyDataReader;
    AisDataReader MyChildReader;
     
    using (AisConnection MyConnection = newAisConnection("server=ALPHA;workspace=navigator;database=RMS;described resultset=true"))
    {
      MyConnection.Open();
      using (AisCommand MyDataCommand = newAisCommand("SELECT emp_id, hchild FROM emp_struct WHERE emp_id = 1111", MyConnection))
      {
          MyDataReader = MyDataCommand.ExecuteReader();
          while (MyDataReader.Read()) 
          {
              MyChildReader = (AisDataReader) MyDataReader.GetValue(1); 
              while (MyChildReader.Read()) 
              {
                  Console.Write(MyChildReader.GetValue(0));
              }
              MyChildReader.Close();
          }
          MyDataReader.Close();
      }
    }
    To Find Out more About Attunity Technology:
    Attunity
    or:
    Contact Us

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •