interface – How do I take rules as inputs from the user?

I'm creating an automation tool that allows users to automate various tasks, such as: For example, sending the best performing products, stores, etc. In the planning phase, I pinpoint the type of interface I need to allow a user to define rules.

So far, I have come up with the following approach:
I have all the column names in a component so that the user can create expressions using components and predefined operators. Well, these are basic components, I want to allow the user to create programmable components that allow the user to define their definition and access the value of that component by creating them in other components.

Basic components will be as follows:

  • unit price
  • Article sells quantity
  • Article current quantity
  • article in stock
  • Article edge

Programmable components can be off

  • Most powerful article
    Max of (sold amount * profit margin)
  • OOS soon article
    Min of (current quantity + stock)

Programmable components can be anything the user can query in the same database. So should I use a similar approach to query input, right?

Many thanks