Using UIBuilder in SSRS contract class

Hi, Below sample code used to get lookups.

In this scenario, i need to get itemid lookup based on Invoice id selected.

UIBuilder class

  1. public class testUIBuilder extends SysOperationAutomaticUIBuilder
    {
    testContract contract;
    DialogField dialogInvoiceId;
    DialogField dialogItemId;
    }
  2. public void build()
    {
    Dialog dialogLocal = this.dialog();
    contract = this.dataContractObject();
    this.addDialogField(methodStr(testContract,parmInvoiceId), contract);
    this.addDialogField(methodStr(testContract,parmItemId), contract);
    }
  3. public void getFromDialog()
    {
    contract = this.dataContractObject();
    super();
    }
  4. public void initializeFields()
    {
    contract = this.dataContractObject();
    }
  5. public void lookupItem(FormStringControl _control)
    {
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource, queryBuildDataSource1;
    SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(CustInvoiceTrans), _control);
    ;

    sysTableLookup.addLookupfield(fieldnum(CustInvoiceTrans, ItemId),true);

     

    queryBuildDataSource = query.addDataSource(tablenum(CustInvoiceTrans));

    queryBuildDataSource1 = queryBuildDataSource.addDataSource(tablenum(CustInvoiceTrans));

    queryBuildDataSource1.addRange(fieldnum(CustInvoiceTrans, InvoiceId)).value(queryvalue(dialogInvoiceId.value()));

    sysTableLookup.parmQuery(query);

    sysTableLookup.performFormLookup();
    }

  6. public void postBuild()
    {
    ;
    super();
    dialogInvoiceId = this.bindInfo().getDialogField(
    this.dataContractObject(),
    methodStr(testContract,parmInvoiceId));

    dialogItemId = this.bindInfo().getDialogField(
    this.dataContractObject(),
    methodStr(testContract,parmItemId));
    // register override method for lookup customer
    dialogItemId.registerOverrideMethod(methodStr(FormStringControl, lookup), methodStr(testUIBuilder,lookupItem),this);

    }

  7. public void postRun()
    {
    Dialog dialogLocal = this.dialog();
    super();
    // This method should be called in order to handle events on dialogs.
    dialogLocal.dialogForm().formRun().controlMethodOverload(false);
    }

Contract class

  1. [
    DataContractAttribute,
    SysOperationContractProcessingAttribute(classStr(testUIBuilder))]
    public class testContract implements SysOperationValidatable
    {
    InvoiceId invoiceId;
    ItemId itemId;
    }
  2. [
    DataMemberAttribute(‘InvoiceId’),
    SysOperationDisplayOrderAttribute(‘1’)
    ]
    public InvoiceId parmInvoiceId(InvoiceId _invoiceId = invoiceId)
    {
    invoiceId = _invoiceId;
    return invoiceId;
    }
  3. [
    DataMemberAttribute(‘ItemId’),
    SysOperationDisplayOrderAttribute(‘2’)
    ]
    public ItemId parmItemId(ItemId _itemId = itemId)
    {
    itemId = _itemId;
    return itemId;
    }

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s