In computer science a string is essentially "… a string is traditionally a “…a string is traditionally a sequence of characters…” (per Wikipedia). Those characters might be letters, numbers, emoji, symbol characters, etc. What we lay folk might describe colloquially as ‘text’.
So a string-type attribute holds a sequence of characters. In Tinderbox a String-type attribute holds one value, insofar as what every characters you type in, it treats them a one pieve of text, so to speak.
But, you say, in Tinderbox I write a list as Hat;Lantern;Map;Latern
. Yes, and if stored as:
- a String, Tinderbox understands it as the single value
Hat;Lantern;Map;Latern
even if when shown like that makes no sense when read. - a List, Tinderbox understands the semi-colon as representing a list item delimiter. Thus it finds not one value, but four:
Hat
,Lantern
,Map
, andLatern
. - placed in a set, which de-dupe lists, detects and stores only three items. Why? Because
Lantern
is repeated in the source data so only one copy is saved, i.e. the attribute storesHat;Lantern;Map
.
So if entering a list (List or Set) attribute value manually, you type the characters as if a String but adding a semicolon between every discrete item.
This is why attribute data types exist. It helps signal intent:
$MyNumber = 4; $MyNumber = $MyNumber + 4;
→ gives a result of 8
, the sum of 4 added to 4.
$MyString = 4; $MyString = $MyString + 4;
→ gives a result of 44
, a string composed of the character 4
twice in sequence.
If you are unclear in you instructions (as to type/intent), Tinderbox will ‘guess’. In most cases correctly, but when it doesn’t, you see peoplle arrive here reporting they got an unexpected effect.
Why, since you say “since I’ll be referencing one amount per note”? That implies you want a single amount value per note, i.e. a single-value attribute.
If the source data is (not more than) one cost per imported note, initially put “$2,500.50” into a String type attribute. If you need to get a number out of that, this will work (remember the attribute names I use here are examples):
$AmountString = "$2,500.50";
$AmountNumber = $AmountString.replace("^[^\d]+","").replace(",","");
// $AmountNumber now holds the number `2500.5`
$AmountNumber = $AmountNumber * 3;
// $AmountNumber now holds the number `7501.5`
$AmountString = $AmountNumber.format("$");
// $AmountString now holds the string `$7,501.50`
So the one piece of data you really need is the numerical part of the code in Dollars (or Dollars and Cents if needed). As the example above shows if you have the number, it is possible to generate a ‘readable’ formatted string if needed.
If the worry is reading on screen, I’d simply show the Number version in Displayed Attributes. OK, $2,500.50 will appear as 2500.5
. This is because a Number shows up to c.6 decimal places but omits trailing zeros. So ‘0.5.0’ appears as ‘0.5’. Still if you know the attribute holds a Dollar cost, the mind’s eye easily reads 25005
as $2,500.50
.
HTH.