Change format of bound textboxes

I have a BAQ DataView that I’m attaching to on a form. Is there any way to change the format on a bound textbox? Right now I’m getting a lot of zeros:

image

The only way I’ve found is to format the output of the BAQ as a formatted string rather than using a number, but I’d like to not have to go in and do that.

Why are they Text Boxes and not Numeric Editors? If they were EpiNumericEditor, then you can specify the decimals.

2 Likes

I never looked down the list on the toolbox.

Thanks!

I see I have a FormatString, but nothing will save when I enter a value in there. It seems to be pulling the Format from the bound BAQ.

You can specify the output format in the BAQ

Fields that are stored as Date can retain thier date value but be displayed in other formats supported by Date types.

And you can dictate if the integer should use commas (->>>,>>>,>>9) or not (->>>>>>>>9)

Reminds me of something similar I did a while back, here is a code snippet that you and others may find useful. It is for populating a custom EpiUltraGrid with BAQ data, but not using the “conventional / built-in” ways. I forget why I needed to go this route - and I regret the maintenance overhead created by sticking all the formatting logic in customization code - but it works very well.

    private void ExecuteSellableQtys(string partnum)
    {
        string querySQ = "[redacted]";
        System.Guid g = System.Guid.NewGuid();
        var QryCtrl = new DynamicQueryAdapter(oTrans);
        QryCtrl.BOConnect();
        QueryExecutionDataSet executionDS = new QueryExecutionDataSet();
        var paramRow = executionDS.ExecutionParameter.NewRow();
        paramRow["ParameterID"] = "PartNum";
        paramRow["ParameterValue"] = partnum;
        paramRow["ValueType"] = "string";
        paramRow["IsEmpty"] = "False";
        paramRow["SysRowID"] = g;
        paramRow["RowMod"] = "";
        executionDS.ExecutionParameter.Rows.Add(paramRow);
       
        QryCtrl.ExecuteByID(querySQ, executionDS);
        EpiDataView SQQueryResults = new EpiDataView();
        SQQueryResults.dataView = new DataView(QryCtrl.QueryResults.Tables["Results"]);
        SellableQtysGrid.DataSource = SQQueryResults.dataView;
        SellableQtysGrid.ReadOnly = true;
        SellableQtysGrid.DisplayLayout.Override.AllowUpdate = DefaultableBoolean.False;

       SellableQtysGrid.DisplayLayout.Bands[0].Columns[0].Header.Caption = "Site";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[0].Width = 175;     
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[1].Header.Caption = "Sellable Qty*";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[1].Width = 85;
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[1].Format = "###,###,###,##0.00";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[1].Header.ToolTipText = "[redacted]";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[2].Header.Caption = "On Hand";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[2].Width = 85;
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[2].Format = "###,###,###,##0.00";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[3].Header.Caption = "Sales Demand";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[3].Width = 85;
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[3].Format = "###,###,###,##0.00";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[4].Header.Caption = "Job Demand";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[4].Width = 85;
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[4].Format = "###,###,###,##0.00";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[5].Header.Caption = "Buy To Order";
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[5].Width = 85;
       SellableQtysGrid.DisplayLayout.Bands[0].Columns[5].Format = "###,###,###,##0.00";
       QryCtrl.Dispose();
    }
1 Like

I tried messing around with the BAQ formats, it even updates on the bound EpiNumericEditor, but the format doesn’t always seem to change. I believe it’s driven by some simple link that doesn’t have the options that you do if it’s unbound.

For example, I don’t think you can conditionally have decimal places. It’s either there or it isn’t. I tried with >>>,>>9.>>, which works in the BAQ, but in the field it still shows 0.00. If I do >>>,>>9 then in the field it shows 0. Then if I do >>>,>>9.99 then it does 0.00 again.

At least I have some control…