CalcBuilder Forum

Question about a table

User moon_1108 2017-05-31 16:06:19


I have the following issue.

I have two fields which gave a result = $result. This result is a number (example 1000)

I have a table with different prices and based on the value from $result I want to show the right price.

Example $table

$result = till 100 price = 50
$result = between 100 en 300 price = 150
$result = between 300 and 500 price = 250

I have tested with a matrix but can't show the right price. It shows nothing when i place this in the code: $pricetoshow= $table

Of course I set $pricetoshow in the exit layout.

How can I do this?

Edited by moon_1108 - 31.05.2017 16:10

Moonsoft support 2017-05-31 17:13:16

the matrix is intended to get a specific cell given the 2 search values (row,column), so you have different options here, if you don't want to create a huge matrix with all possible values :


which would give you the right result but it would be a great task to create and maintain. We suggest to create your table with different options, following your example:

till100 50
100-300 150
300-500 250

and at the code, introduce a condition to get the proper row key for each case:

//calculate $result

//generate the right key

100 && $result

300 && $result


Of course you should replace on the above the for lower than and greater than symbols, they are stripped by the forum rules.

This should do the work, please let us know if you need further help.

Edited by MSTeam - 31.05.2017 17:16

User moon_1108 2017-05-31 22:06:51


Thank you very much for the good and quick answer. I think its nearly good. But it won't work complete. This is what I did:

Table variable = $tableopp with one column = "oppervlakte"

first item till100 has 780 as price value
second item 100-300 has 805 as price value
third item 300-500 has 900 as price value

I have two fields for the sum: $kas and $buitenteelt (last is multiply with 0.25). Together they are $result.
This is the code:

//calculate $result

//generate the right key

if($result{100 && $result}=300){

if($result{300 && $result}=500){

(I also changed the greater and lower than symbols in this forum)

And this is exit layout:
bedrag.... ##result##
price.... ##pricetoshow##

But the pricetoshow is not in the results?

Hope you can help me further.


Edited by moon_1108 - 31.05.2017 22:08

Edited by moon_1108 - 31.05.2017 22:10

Edited by moon_1108 - 01.06.2017 13:37

Moonsoft support 2017-06-01 09:06:08

we assume if that your column is called 'oppervlakte' you used to recover values:


instead of 'price' we had at the example. We suggest to check this, and also to print on your result section the intermediate results that will guide you to the point where your result is empty. We'd print


in order to find out if your search value is valid.


so you will see if you're getting a valid row reference with conditional expressions.

If you can't get it working please export your calculator, zip it and create a new ticket at your helpdesk and attach it there. We'd take a quick look and let you know how to correct. At the helpdesk we can also share code without restrictions.

Thanks, regards

User moon_1108 2017-06-01 13:37:34


It won't work for me. I did send you a ticket with my calculator.


Support/development 10 hours

Get a bigger amount of hours for more complex tasks and get a 10% discount

Buy now!
List Manager

Build different lists for your site

Buy now!