Skip to content

Converting Touch App resources to Aurena Native

How "old fndmob" c# annotations map to projections in Aurena Native:

App Setup

Apps 9 / 10

AssemblyInfo.cs:

[assembly: AppVersion(Name = "FndmobApp" , Major = 1, Minor = 0, Revision = 0, Component = "FNDMOB")]  

[assembly: AppSettings(CustomFieldEnabled = true, UseMessaging = true, UseServerSideErrorHandler = true,   
    AllowMultipleDevices = false, GPSEnabled = true)]  

  • Name
  • Component
  • Major.Minor.Revision
  • UseServerSideErrorHandler
  • AllowMultipleDevices
  • GPSEnabled

UXX

.app file:

App Model Example

  • Appname
  • Component
  • Version
  • Error handling (Server/Client)
  • Multiple Devices (Enabled/Disabled)
  • GPS Tracking (Enabled/Disabled)

Entity Resource

Apps 9 / 10

Entity resource is defined by a c# class and extending DynamicEntityResource class. Entity resources is normally based on a LU view.

[Entity("IsoUnit", "ISO_UNIT", "BasicData",   
        PackageName = "ISO_UNIT_API",   
        DefaultWhere = “”,  
        WriteEnabled = false,   
        DeliveryMethod = EntityAttribute.DeliveryType.NewBatch,  
        DefaultSchedule = "DAILY AT 23:00",  
        TableName = "ISO_UNIT_TAB",  
        ObjversionFormat = "number"  
        )]  
class ConnectToolsFacilities : DynamicEntityResource  
{  

}  

  • DefaultWhere
  • PushGuardFunction
  • OwnershipQuery
  • WriteEnabled
  • PreBlock
  • PostBlock
  • DeliveryMethod
    • PushAndBatch
    • NewBatch
  • ObjversionFormat
  • DefaultSchedule
  • TransactionGrouping

UXX

Entity is defined in the projection by overriding the default entity definition. A corresponding entityset definition is also required for the entity to be accessible in the client.

@Override  
   entity IsoUnit {  
      syncpolicy Batch {  
         syncschedule = monthly on day 3 at 20:30;  
      }  
      crud = Create, Read, Update;  

      exclude attributes = ‘TYPE’; OR use attribute Abc, Xyz  

      where = "country like ‘A%’";  
   }  
}  

  • Where
  • guardcondition
  • ownershipquery
  • crud = Create, Read, Update;
  • Override CRUD_Xxx___ methods in the svc package - making sure to return a valid etag
  • Override CRUD_Xxx___ methods in the svc package - making sure to return a valid etag
  • syncpolicy
    • Push
    • Batch
    • Grouped Push - Used to sync entities which have same data set for group of end users
    • Client Cache
    • Online Only
    • Incoming
  • Derived from the entity model
  • syncschedule = daily at 20:00;
  • transactiongroup

Entity Attribute

Apps 9 / 10

We only added attributes we want to sync down to the device.

Derived Attributes

private String mStdJobDefinition;  
[Field("STD_JOB_DEFINITION", SqlExpression = "Standard_Job_API.Get_Definition(std_job_id,contract,STD_JOB_REVISION)")]  
public String std_job_definition { get { return mStdJobDefinition; } set { mStdJobDefinition = value; } }  

Key/Parent key Attribute

[Field("FUNCTION_ID", Key = true)]  

[Field("WO_NO", TableColumnName = "WO_NO", ParentKey = true)]  

Temporary Client keys

[Field("MOB_SIGNATURE_LINE_NO", TableColumnName = "MOB_SIGNATURE_LINE_NO", Key = true, TemporaryClientKey = true)]  

UXX

By default, projection entity will add all LU view attributes to the meta data. So, in UXX, you will need to exclude un wanted attributes.

All attributes are added to the entity. Unless they have been excluded.

exclude attributes = MyAttrib;  

It is also possible to explicitly specify the list of attributes to include in the entity

use attributes = MyAttrib;  

Attributes with fetch Statement

attribute StdJobDefinition Text {  
      label     = "Std Job";  
      fetch     = "Standard_Job_API.Get_Definition           
                  (std_job_id,contract,STD_JOB_REVISION)";  
      type      = String;  
      required  = [false];  
      editable  = [false];  
}  

Key/Parent Attribute are now derived from the entity model flags. Entity Attribute Example

Temporary Client keys are now derived from the entity model meta data

PLSQL Block

Apps 9 / 10

[PlsqlBlock("WorkOrders", "AddJournalEntry", Statement = AddJournalEntry.SQL)]  
class AddJournalEntry : DynamicPlsqlBlockResource  
{  
    public const String SQL =   
        @"DECLARE  
            wo_no            VARCHAR2(35);  
            user_id          VARCHAR2(35);  
            BEGIN  
            user_id := :user_id;  
                wo_no   := :wo_no;                                                        
                &AO.Mobile_Work_Order_Util_API.  
                        Create_Mobile_Download_Journal(wo_no);  
            END;";  
}  

  • Parameter
  • Direction

UXX

Action in Projection Model Implement the corresponding pl/sql method in the svc package

  • Parameter
  • not in use

Advanced Query Resource

Apps 9 / 10

[Entity("EquipmentSpareStructure", "EQUIPMENT_SPARE_STRUCTURE", "Parts",   
   PackageName = "Equipment_Spare_Structure_API",   
   WriteEnabled = false,  
   QueryStatement = MobileEquipSpareStructure.QUERY,   
   TableName = "EQUIPMENT_SPARE_STRUCTURE_TAB",   
   ObjversionFormat = "number",   
   DeliveryMethod = EntityAttribute.DeliveryType.NewBatch)]  
class MobileEquipSpareStructure : DynamicEntityResource  
{  
    const String QUERY = @"SELECT……….  
                            FROM <view_name>  
                            WHERE <attr> like ‘A%’  

}  

UXX

Entity in Projection Model (Based on SQL/VIEW)

Entity in the projection with from clause to fetch data from the PL view. So same SQL statement can be added as view in the LU.

entity Flight {  
   from = "<view_name>";  
   where = "<attr> like ‘A%’";  

   attribute Description Text;  
   attribute Company     Text;  
}  

It is also possible to use query definitions in the projection model

Entity Dependency

Apps 9 / 10

[EntityDependency(typeof(TstCompany), new String[] { "COMPANY" }, new String[] { "COMPANY" }, false)]  
[EntityDependency(typeof(TstCustomer), new String[] { "COMPANY" }, new String[] { "COMPANY" }, true)]  

UXX

reference CompanyRef(Company) to TstCompany(Company);  
array Customers(Company) to TstCustomer(Company);