Syntax Help for Export definition

Hello,

Could you kindly assist with a syntax description for my IF statement? We are unsure how to properly get this to work. The context is:

We are trying to create an export that shows all products with a calculated list prices, that is higher then product ->default sales item → calculated list price (basically if netto amount is higher then the bruto amount (as there was an incorrect upload done).

My if statement is as following:
IF; “calculated list price” => “product;default sales item;calculated list price”; then SHOW, else don’t SHOW.

We tried with string.if, and boolian.if, but struggle to get a working statement. Especially as the second calculated list price is nested under two parents.

Could you kindly assist? If you need more context please let me know.

Kind regards,
Suzanne

Hi Suzanne,

To export a list of products you don’t necessarily need to use an if statement.
You can simply put an isgreaterequal statement in the where part:

{
products,
this,

this.calculated_list_price().isgreaterequal(
this.default_sales_price_list_item.calculated_list_price()
)

}

This way you only export products where calculated_list_price() is greater or equal than the calculated_list_price() of the default_sales_price_list_item of this product.

Does this help?

1 Like

Hi Redmer,

Thank you for your swift response. I have tried your suggestion and get the these results:

When i take the Data type salespricelistitems i get this result:

And when I take Product i receive:"

If I take your full suggestion it also doesn’t work.

Could you kindly assist?

KR
Suzanne

Hey Suzanne,

The reply by Redmer used the [products] table as the starting point. From this starting point the usage of the [default_sales_price_list_item] is necessary to reach the table with the sales price list items.

In your export you already use the table [salespricelistitems] as the starting point, eliminating the need for the suggested filter by Redmer.
Looking at your request I would suggest using the following statement:

this.calculated_list_price().isgreater(product.default_sales_price_list_item.calculated_list_price())

This expression jumps back to the [products] table and uses the default sales price list item for the check.

Other additions to the filter could also be to check if the sales price list item != the product.default_sales_price_list_item, or if the sales price list item is_active, or maybe a selection based on price_list could be useful.

Let me know if this helps!

1 Like