Noob row rule question

Is there a way to create an if then statement in row rules wizard?

It is not possible to add an IF statement with row rules wizard. You can try to hack your way with the “Custom Condition” option available in the wizard. It will create a blank custom condition function, in which you can put your IF statement:

private bool RowRuleApplyEngDemandButtonLayout_CustomCondition(Ice.Lib.ExtendedProps.RowRuleDelegateArgs args)
{
    bool result = false;
    // ** RowRuleDelegateArgs Properties: args.Arg1, args.Arg2, args.Context, args.Row
    // ** put Row Rule condition evaluation logic here
    string engDemandID = Convert.ToString(args.Row["UD_EngDemandID_c"]);
    string salesCatID = Convert.ToString(args.Row["UD_SalesCategory_c"]);

	if(string.IsNullOrEmpty(engDemandID) && oTrans.CoreSession.CompanyID == "10" && (salesCatID == "Susp" || salesCatID == "Proj"))
    {
        result = false;
    }
    else
    {
        result = true;
    }

    return result;
}

If you are working with a BAQ/Dashboard, I find it much easier to put all the logic in a calculated field, in the BAQ. For example, I would create a bit (bool) calculated field named “IsLate” and put the “IF” statement right there:

Case when DueDate < GetDate() then 1 else 0 end

Then, in the Row Rules wizard, I would create a rule that highlights the field if Calculated_IsLate equals true.

3 Likes

I second this approach. It works every time!

How would you point to the BAQ field if you are customizing a workbench?

I am not sure about workbenches, but when you customize a dashboard, you can use the row rule wizard to point to the calculated field from the BAQ. You have to create the dashboard from the BAQ you want to use. Make sure to put the BAQ in a grid on the dashboard and ensure the calculated field you need to reference is included in the grid. Then just use the row rule wizard.
Let us know what you have so far, what does and doesn’t work, and we can help get you across the finish line.

That makes sense. What I am trying to do is the following: If Partwhse.checkbox01 = true then select partwhse.warehousecode. Checkbox01 designates the warehouse where we receive parts into. Can you help me with the customization code needed to do this on PO entry?

Do you mean Receipt Entry, or are you sure you are trying to customize PO Entry? Where do you want the combo box? What grid do you want to highlight the row in?

PO Entry. The box already exists and populates based on the prime warehouse. We have a non-prime warehouse that is “stocking”. PORel.WarehouseCode is the field I’m trying to customize to fill in the warehouse based on the true value of partwhse.checkbox01.

:thinking:
This is a tricky one! I thought you were trying to use row rules, which highlight rows in a grid.
Sorry, I can’t help you here, but I bet someone else can. Editing the built-in forms is always more difficult than making changes to your own dashboard. Perhaps a data or method directive is a better approach?
Good luck!

Ok. Thanks! Hopefully someone can help. I have the code for receipt entry that works as intended. I just need to apply this same concept to PO entry.

It looks like the only parts of your ReceiptEntry function that would need changing are wherever it uses edvRevDtl: your source of the PartNum. You’ll substitute in the equivalent that you have for POEntry, and it should work similarly.
Do you already have code set up similar to what calls this function?