0

Change field colour based on sum

I have the following code:

 

let AA := sum('Seamless QTY on Hand (Bags)') + sum('HELP QTY on Hand (Bags)') + sum('Mt Waverley QTY on Hand (Bags)');
if AA < sum('Low Stock Level') and AA > sum('Re-Order Level (bags)') then
styled(text(AA), "yellow")
else
if AA < sum('Re-Order Level (bags)') and < sum('Low Stock Level') then
styled(text(AA), "red")
else
styled(text(AA), "#dfdfdf")
end
end

 

Which is not working as it should. If stock levels get below low stock number, the field should be yellow. If its below the re-order level, it should be red. Otherwise, it should be grey.

Probs something obvious I'm missing D:

1 reply

null
    • SECOS Group
    • quartz_cap
    • 4 yrs ago
    • Reported - view

    Figured it out. I switched to a previous version of the formula which hadn't been working, and realised I'd left out "and AA" before the <

     

    let AA := sum('Seamless QTY on Hand (Bags)') + sum('HELP QTY on Hand (Bags)') + sum('Mt Waverley QTY on Hand (Bags)');
    styled(text(AA), if AA < sum('Re-Order Level (bags)') then
    "red"
    else
    if AA > sum('Re-Order Level (bags)') and AA < sum('Low Stock Level') then
    "yellow"
    else
    "#dfdfdf"
    end
    end)

Content aside

  • 4 yrs agoLast active
  • 1Replies
  • 826Views