Search This Blog

Wednesday, December 7, 2016

Hide Query values in the dialog with select button Enabled


Scneario: we want to hide the query values that was selected by the user in query range select button.

I created the parmmethod as below in the class Dialog,RunBaseDialogModify


public boolean hideQueryValuesInDialog(boolean _showValues = showValues)
{
;
    showValues = _showValues;

    return showValues;
}

Added the highlighted code as below in the following method of class RunBaseDialogModify


client public static RunBaseDialogModify newRunbaseOnClient(
    RunBase         runBase,
    DialogRunbase   dialog)
{
    // <GEERU>
    RunBaseDialogModify runBaseDialogModify = RunBaseDialogModify::construct(runBase.runBaseDialogModifyType_RU());
    // </GEERU>
    ;
    runBaseDialogModify.parmRunbase(runBase);
    runBaseDialogModify.parmDialog(dialog);

//Addded by krishna
   runBaseDialogModify.rsaShowQueryValuesInDialog(dialog.rsaShowQueryValuesInDialog());
//Addded by krishna

    return runBaseDialogModify;
}

Server public static RunBaseDialogModify newRunbaseOnServer(
    RunBase         runBase,
    DialogRunbase   dialog)
{
    // <GEERU>
    RunBaseDialogModify runBaseDialogModify = RunBaseDialogModify::construct(runBase.runBaseDialogModifyType_RU());
    // </GEERU>
    ;
    runBaseDialogModify.parmRunbase(runBase);
    runBaseDialogModify.parmDialog(dialog);
//Addded by krishna
    runBaseDialogModify.rsaShowQueryValuesInDialog(dialog.rsaShowQueryValuesInDialog());
//Addded by krishna
    return runBaseDialogModify;
}

// <GEERU>
protected boolean addField(SysDictField _dictField, Set _fieldNameSet, LabelType _labelType, Range _range)
// </GEERU>
{
    boolean         ret = false;
    Map             map;
    DialogField     dialogField;
    TableId         tableId;

    if (_dictField)
    {
        tableId = _dictField.tableid();
        if (_fieldNameSet.in(_dictField.name()))
        {
            if (this.existField(_dictField))
            {
                this.addRange(this.getFieldName(_dictField), _range);
        }
    }
    else
    {
        ret = true;

            if (!dialogQueryFieldsMap.exists(tableId))
        {
                dialogQueryFieldsMap.insert(tableId, new Map(Types::String, Types::String));
        }

            map         = dialogQueryFieldsMap.lookup(tableId);
        dialogField = dialog.addField(extendedTypeStr(RunBaseRange), _labelType);

        dialogField.value(_range);
        dialogField.allowEdit(false);

//Addded by krishna
//  dialogField.visible(true);
        if(!showValues)
        {
            dialogField.visible(false);
        }
        else
        {
            dialogField.visible(true);
        }
//Addded by krishna

            map.insert(_dictField.name(), dialogField.fieldname());

            _fieldNameSet.add(_dictField.name());
        }
    }
    return ret;
}


In your runbasebatch class override the method as below
public DialogRunbase dialogInit(DialogRunbase dialog, boolean forceOnClient= false)
{
    DialogRunbase ret;
//Addded by krishna
    if (! dialog)
    {
        if (xGlobal::clientKind() != ClientType::Server || forceOnClient)
            dialog = DialogRunbase::newOnClient(this.caption(),this);
        else
            dialog = DialogRunbase::newOnServer(this.caption(),this);
    }
    dialog.rsaShowQueryValuesInDialog(false);
//Addded by krishna
    ret = super(dialog, forceOnClient);

    return ret;
}


The above changes will hide your query range selected values in the dialog with showing select button.

No comments:

Post a Comment

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.