DecimalForCopyPaste

Revision as of 23:38, 29 September 2016 by Lchrisman (Talk | contribs) (Updated the default to region)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

new to Analytica 5.0

SysVar DecimalForCopyPaste

Background: International conventions for the decimal point

In many countries, including almost all English-speaking countries, the dot ('.' = Chr(46)) is used as the decimal point in fractional numbers, whereas in other parts of the world the comma (',' = Chr(44)) is used as the decimal point. Where the dot is used, the comma is generally used to group digits into thousands, while the regions that use the comma as a decimal generally use the dot a thousands separators.

One-thousand two-hundred thirty-four point 56 is written as

Dot-as-decimal: 1,234.56
Comma-as-decimal: 1.234,56

Analytica's user interface uses the dot-as-decimal convention, e.g., 3.14159 -- the convention used in English-speaking countries (except Rep of South Africa), Mexico and central America, East Asia (except Indonesia), Egypt and most south, east and west African nations. Within the UI, it does not mix conventions. In particular, the comma has a specific use in expressions as the parameter separator character, and hence cannot be used in expressions without introducing a syntactic ambiguity.

There are a few countries in the middle east that make use a character other that the dot or comma as a decimal point. Analytica does not handle these conventions.

Copy and Pasting

If you are in a country that uses the comma-as-decimal convention, which includes mainland Europe, South America, and much of central and northern Africa, you may run into an issue with copying or pasting data between Analytica and other application programs. Obviously, when copying numbers over the clipboard, both applications need to used the same convention.

The Analytica system variable DecimalForCopyPaste controls the convention that Analytica uses when copying data to or from the clipboard. It can be assigned to be any of the following possible values:

  • 'Region' : (Default) Uses the convention set by your operating system's regional settings.
  • 'TextLocale' : (default) Uses the convention from the region specified in the system variable TextLocale.
  • '.' : Forces the dot-as-decimal convention.
  • ',' : Forces the comma-as-decimal convention

By default, 'Region' is used, which in turn by default uses your regional setting unless you have changed it.

The system variable is a user-level setting, so that it applies to your account on your computer, not to your model. If you change it, the setting will persist after you quit and restart Analytica. The setting is not saved with your model, so changing this will have no impact on other users of your models.

When to change

You will only need to change this if you encounter an application that uses the opposite convention and you need to copy/paste data to or from that application. For example, you might be in Italy, where the comma-as-decimal convention is used, but find you need to copy/paste data from an application that uses the dot-as-decimal convention.

You might also download some data from the internet that uses a convention other than your local convention, and find you need to copy that data into an edit table in your model, for example while viewing the data in a text editor.

Another scenario would be when you need to copy some data into an email that you are sending to someone in a different country, who expects a different convention.

How to change

To change the convention used, from Edit mode, with nothing selected, navigate from the main Analytica menu to

Definition → System Variables → Settings → Decimal for copy/paste

This opens the Object Window for DecimalForCopyPaste. From there, change the definition to one of the permitted values.

Excel's convention

Excel uses the system regional setting by default. This will match the default setting used by Analytica, unless you've changed the default in either Excel or Analytica.

Excel allows you to change the convention it uses from the File / Options / Advanced panel, where you can customize the Use system separators.

What is and is not affected

Basically, only data passed via Copy/Paste or OLE linking are impacted by this system variable. Data passed through other channels are not impacted by this system variable. When you copy to the clipboard, an application can post multiple formats. The Text and Unicode Text formats are the formats that are impacted.

OLE linking is impacted by this setting. Hence, the Analytica setting and your target application's convention must agree. Once you've set up a link (via Copy/Paste Special...), you don't need to redo the link if you change the setting, but you may need to refresh the data.

Database queries, Spreadsheet functions, and COM calls are not impacted by this setting. These should function (for numeric types) just fine regardless of regional conventions.


The ParseCSV and ParseNumber functions have their own «decimal» parameter to specify the decimal convention, allowing either convention to be handled. These do not use this system variable setting.

The Analytica user-interface displays everything using the dot-as-decimal convention. This cannot be changed.

History

  • This system variable was introduced in Analytica 5.0.
  • In releases prior to Analytica 5.0, the dot-as-decimal convention was always used during copy/paste. With these releases, you should change the Use system separators option in Excel to the dot-as-decimal convention when copy/pasting data.
Comments


You are not allowed to post comments.