Project Fractal - wrong sorting

I’ve sent to web a basic dynamo script, just to get familiar with Project Fractal.
The script allows you to create a building with variable number of floors and variable floor surface area. The scipt then calculates the total cost, given a fixed cost per square meter.

When I generate options in Project Fractal and I try to sort them (e.g. per cost), the list is not sorted correctly.

Anyone having the same issue?


Can you share a link to the fractal page and/or some screenshots of the behavior?

Here is a screenshot of the Fractal page. As you can see I sort by decreasing Total Cost (which is just proportional to surface area) but I get a wrong order. In the screenshot you see that an option with many floors come after the one with just one floor.

Am I missing anything? Thanks in advance

Hard to see what if anything you’re missing with this, but my gut says it’s sharing based on first digit sorting not overall value sorting. Please share the Customizer link and I can confirm.

Correct! It sorts digits from left to right, independently on how many digits there are (e.g. independently of the real number). For example 1200 comes before 100000.

How can I solve this? Good catch by the way, thanks.

Confirm the data type is still a number in your .dyn. If it’s a string than convert it to a number, upload your graph again, and see if that fixes it.

If it’s still a number or if it wasn’t resolved by ensuring it’s a number, then convert the value to a string, and pad the value on the left (string.padleft node) with 0’s so it’s at least as big as your functional upper limit - say 12 digits, or 999,999,999,999. A value of $1 would then read as 000,000,000,001.

If you hit a trillion dollar building this would fail, but I’d be skeptical of that scale here anyway.