Calculate area of a rectangle


#1

Has anyone created a simple way to calculate the area of a rectangle?

EXAMPLE: We allow a user to change the size of a rectangle’s width and height. Dynamically calculate the area of the rectangle (A = W * H). Then I can use a linear converter to convert the pixel area to any unit I need (in my case nautical miles.)

I can’t seem to figure out how to get Intuiface to multiply one dynamic value against another. And it won’t draw in the value of an excel cell that is the product of a calculation. Tried that.

I thought this would be simple, and maybe I’m trying to over-engineer it, but man this is killing me.

-Dave


#2

Looks like Intuiface will only perform an Excel recalculation when you include a specific action like Set Text, as opposed to binding the cell to the text field. I recreated your scenario and it works well. But, if I just bind the cell to the Excel formula, it doesn’t.


#3

Hi @david_gaudet,

My answer wouldn’t have been better than Paolo’s :slight_smile:
Excel is the solution to your question, using an action to retrieve the result after changing the inputs of your formula.

Tell us if that works for you.

Seb


#4

Thank you both very kindly for your replies. I actually did try this and it still doesn’t work. The excel file does the correct calculation, but when I create a button trigger to set my text with the value from the product of the calculation it still comes up as zero.

So I tried creating a brand new, super simple XP nearly identical to Paolo’s above and it still calcs out to zero.

Then I downloaded the sample XP from the documentation page that Paolo kindly linked and without modification (except for the automatic conversion to 6.0.6) it was also broken. Although rather than zero it would only yield whatever digit I entered into the first box as the answer even tho the excel spreadsheet does the math correctly.

All my other excel functions work perfectly. If I could get this to work it would be glorious. ;D

I can’t share my test files thru the Intuiface share function due to our firewall rules, but I can send it by email if you want to see it.

Thanks again!
Dave


#5

I’m curious to try your XP and XLS - Feel free to send it to me - paolo at tosolini dot com


#6

Thanks for the interest Paolo. Here’s hoping you find something that I’m doing that’s glaringly goofy. I’d much rather have it be pilot error than having something broken with my install or worse, something broken in the software. :blush:

Anyway, I sent my test XP to the email you provided.

Best,
Dave


#7

Just a followup: After Paolo graciously took the time to look at my Excel file he discovered that the width and height number values were being inserted by Intuiface into the corresponding Excel cells as text values. What made things confusing and difficult to troubleshoot was that even though the arguments were inserted as text values, Excel was displaying and treating them as numbers and even performing the correct calculations.

It wasn’t until we changed the arguments to actual numbers in excel (not just formatting the cell type) did Intuiface allow us to set the value of our text object with the correct results of the calculation.

I’m not sure if this is a bug or a limitation, but I’ll submit as the former and see how it pans out. But at the very least there should be some kind of notation about this on the documentation page that explains how to use this function.

-Dave


#9

Hi @david_gaudet,

Thanks for pointing out this missing info, we are going to update the article you mentioned.
Just FYI, this info was somehow available in this main Excel article section.

Seb


#10

Thanks Seb,

After the pressure was off to get my project completed, I did go back to the Excel article and carefully read through and found therehttp://support.intuilab.com/kb/interface-assets/interface-asset-excel#how-to-create-an-excel-spreadsheet-for-use-within-intuiface the info you are referencing nested a couple of bullets in. It has since inspired me to go back thru all the documentation and mine for other gems that I might have missed. I’m sure there are a few ‘WHOA!’ items in there that I’ve overlooked and that would not necessarily be uncovered by using the search tools.

Sometimes I really wish this was the only software I had to work with so I could fully excel (no pun intended) with it. But, sadly, I also have to be proficient with at least a dozen other (even more intensive) graphics packages to make my boss happy. And to that end I’m really grateful that Intuiface is as intuitive as it is. You and your team make it that way and your support is truly and genuinely appreciated.

Best,
Dave