Formatting numbers in a loopHello,
I'm formatting decimal numbers in a loop, and it works on the first row but the 2nd row and thereafter it throws a type error
for each row(my_data,
:my_col = Format( :my_col, "Fixed Dec", 16, 3, "Use thousands separator");
);
Error:
First row everything formats fine but I can't seem to figure out why it fails after.
Thanks
Automation and ScriptingRe: Formatting numbers in a loopFormat() returns a string (or "quoted format"), so on first row you still have number which you use as input. Then JMP converts all the values to characters in the column -> no more number
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(2),
Compress File When Saved(1),
New Column("Column 1", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2]))
);
For Each Row(dt,
show(type(:"Column 1"n));
:"Column 1"n = Format(:"Column 1"n, "Fixed Dec", 16, 3, "Use thousands separator")
);Re: Formatting numbers in a loopAlso there should be no need to do this in a loop as you can just change the column properties (unless you want to possibly lose some precision, then you might want to loop)
Data Table("Untitled"):Column 1 << Format(
"Fixed Dec",
Use thousands separator(1),
13,
3
);
Re: Formatting numbers in a loopThanks for your clarification on that.
I was looking to display some long float numbers in an outline box. I needed to shorten the length of the number.
I found that Left(Char(:mycolumn), 5); is better suited for my case and I don't lose any precision.