Menu

Retrive criteria

2004-10-22
2013-03-07
  • Nobody/Anonymous

    hi,

    I have the following code in my xml:
    <class name="Material" table="material" database="erp" namespace="Logistica">
            <attribute name="CodigoMaterial" column="CodigoMaterial" find="true" key="primary"></attribute>
            <attribute name="Nombre" column="Nombre"></attribute>
            <attribute name="Descripcion" column="Descripcion"></attribute>
            <attribute name="StockTotal" column="StockTotal"></attribute>
            <attribute name="Precio1" column="precio1"></attribute>
            <attribute name="Precio2" column="precio2"></attribute>
            <attribute name="Precio3" column="precio3"></attribute>
            <attribute name="FamiliaMaterial"></attribute>       
            <attribute name="ProveedorMateriales"></attribute>       
            <attribute name="CodigoFamiliaMaterial" column="CodigoFamiliaMaterial"></attribute>       
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />               
        </class>
    <class name="Almacen" table="almacen" database="erp" namespace="Logistica">
            <attribute name="CodigoAlmacen" column="CodigoAlmacen" find="true" key="primary" />
            <attribute name="Nombre" column="nombre" />
            <attribute name="Descripcion" column="descripcion" />
            <attribute name="Direccion" />
            <attribute name="AlmacenMateriales"></attribute>
            <attribute name="Pedidos"></attribute>                           
            <attribute name="CodigoDireccion" column="CodigoDireccion" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
        </class>
    <class name="AlmacenMaterial" table="AlmacenMaterial" database="erp" namespace="Logistica">
            <attribute name="CodigoAlmacen" column="CodigoAlmacen" find="true" key="primary"></attribute>
            <attribute name="CodigoMaterial" column="CodigoMaterial" find="true" key="primary"></attribute>                       
            <attribute name="Material"/>       
            <attribute name="Stock" column="Stock" />
            <attribute name="StockMinimo" column="StockMinimo" />
            <attribute name="StockIdeal" column="StockIdeal" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />               
        </class>   

    I need recovery cursor with codigoMaterial and nombre of the Material object, but only Material of the Almacen object. I need uses result.result dataset to view in a datagrid. with this i have manipulate the datagrid to order, and assign primary key to find.

    Saludos

    Victo

     
    • Richard Banks

      Richard Banks - 2004-10-25

      Hi Victor,

      I'm sure it's just the language barrier, but I'm not really sure what you want.  Can you try to explain it again in a different way.

       
    • Nobody/Anonymous

      I want recovery a dataset of the two tables, because i have a manyTomany relation, i need view columns of the both in a data grid(in a resulset)

       
    • Nobody/Anonymous

      Thats right, i am using CMultiRetrieveCriteria.
      it is correct.

       
    • Richard Banks

      Richard Banks - 2004-10-26

      Well, the basic structure for a many-to-many is to use a  class to manage the many-to-many association and to create one-to-many associations from the two business classes to the association class.

      You already have these defined so you just need associations as follows:

      Material to AlmacenMaterial (1-to-Many)
      AlmacenMaterial to Material (1-to-1)
      Almacen to AlmacenMaterial (1-to-Many)
      AlmacenMaterial to Almacen (1-to-1)

      To retrieve Material and Almacen in a single data set you need a multi retrieve criteria that joins from Material to AlmacenMaterial to Almacen

      Does that make sense?

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.