Formating Output in Information Design Tool - business-objects

When working with IDT 4.1 and when making a query in business layer, is it possible to format the yielded numbers? What I mean is - the output looks something like "1.9982121921**E7**" (please noctice E7 part). I would like BO to display the whole number without any suffixes.
Additionally, it would be even better to add a delimiter after thousands, millions,...

Is 1.9982121921**E7** the value that is returned from the database? Thus not a number but a string (alphanumeric)? In that case, you'll have to change the select statement and use a database function to trim the non-numeric characters off (e.g. SUBSTR, MID, LEFT, …).
Once you have numeric data, you can use the Display Format function to change the layout of your object.
If you're not happy with the predefined formats to choose from, you can always define a custom format. The formatting options are described in the Information Design Tool User Guide (links to the documentation for IDT in BI 4.1 SP3), section 12.10.23 Creating and editing display formats for business layer objects.
Right-click and object and select Create Display Format… from the context menu.
Or click the Create Display Format… button in the object's properties (located in the Advanced tab).

Set the type to numeric and enable the high precision check mark.

Related

Change format of devise in apps script

I've a Sheets with many values in euro with 3 values after the decimal point (for exemple (2,154 €). I would like to convert this document in PDF to join it in mail.
When I convert it in temporary Sheet, this value change and I have 2.154 instead of. I would like to change the format of this cell.
So I decided to apply a setFormatNumber (.setNumberFormat('#,###.000 [$€]')) at this value but I don't get the result what I want. I obtain 2.154 € but I would like to have "," an not "." to separe entire to decimal values. I try to modify setFormatNumber by (.setNumberFormat('#,###,000 [$€]')) but my result is 2.154000 €.
I don't want to apply toString method and use replace method after because I think it's possible to have what I want by using this method.
Anyone can help me with that please ? I don't join my code because it's so long and, except the setNumberFormat, it's not interesting for you but if you need it, I can edit my post. Sorry for my english, I don't speak and write it very well.
Dots and commas have other meanings in the context of this “mask”-like parameter.
The numberFormat parameter of the setNumberFormat() is documented here.
According to the documentation, dots indicate where the decimal separator will be in the mask and commas indicate where the thousand separator will be.
The symbol of the decimal separator is however controlled according to the Spreadsheet locale settings.
You can change those settings via UI going to File > Settings > General > Locale or via Apps Scripts using the method SpreadsheetApp.getActive().setSpreadsheetLocale('XXXXX')

How do I fill a list with all the world's phone prefixes in Dart on Flutter?

I'd like to implement an app with Dart on Flutter. I'm on my first approach with this new language and for the first time I meet this problem.
My app must necessarily work with a mobile phone number. I would like to see a ban on the insertion of unse prefixed telephone numbers or, alternatively, the typing of a number with more digits than expected. For example, in Italy the figures after +39 (0039) are at most 10. I probably thought I'd separate the two parts to make it easier to distinguish between lengths (one field where you select the country and another that allows you to enter the number).
Is there, as you know, a JSON that contains exactly: - the prefix of each state, - the length of the telephone number (excluding prefix), - name, *flag and *sigla (Italy, green-white-red, IT)?
Sifting through the web a little bit, I saw that flutter should actually provide already in itself with .demoTextFieldEnterITPhoneNumber, through GalleryLocalizations to do such a job, but I didn't quite understand if it bothers to control a particular regular expression for each nation or not. Could I copy and paste a number for example? Will nationality be automatically recognized?
In the end I think that such a control, so deep, is not possible so I would just need this, so make two fields, one with a list, which at the choice automatically fills in depending on the selected prefix, and a field on which the user types his number: in case of copied and pasted number check if that string also contains a +prefix.
Thank you very much, I need a lot, since my app will mainly revolve around a correct value for this field. :)
Try using the international_phone_input or country_code_picker flutter package. They are quite easy to implement

How to get all allowed languages for Wikidata

I'm writing a tool for interacting with Wikidata where labels and descriptions are added to items. But I would like to validate that the language is supported before trying to add it.
So my question is how do I get a list of the allowed language codes. The documentation describes this as UserLanguageCode but gives no info on retrieving the allowed values.
I know I can get a list of all of the used languages by doing the following SQL operation on the database, but that is both slow and inefficient: SELECT DISTINCT term_language FROM wb_terms.
As an aside is the list of allowed languages the same for MonolingualText statements?
There is now an API for getting the supported content languages (API sandbox):
https://www.wikidata.org/w/api.php?action=query&meta=wbcontentlanguages&wbclcontext=term&format=json&formatversion=2
By default it just returns the language code, but you can add the name and/or autonym (name in that language) via the wbclprop parameter. (To control the language in which the name is returned, set the global uselang parameter.)
To get allowed monolingual text languages, set wbclcontext to monolingualtext instead of term; on Wikidata, you can also set it to term-lexicographical for all language codes supported on lexicographical data (almost but not quite identical to the term languages).
User hoo on IRC channel #wikidata found this solution:
Get the JSON payload at this address:
https://www.wikidata.org/w/api.php?action=paraminfo&modules=wbsetlabel
And extract
modules[0].parameters[8].type
There are indeed less languages in this list than all the UI languages for MediaWiki.

When could a CSV records *not* have the same number of fields?

I am storing a series of events to a CSV file, each event type comes with a different set of data.
To illustrate, say I have two events (there will be many more):
Running, which has a data set containing speed and incline.
Sleeping, which has a data set containing snores.
There are two options to store this data in CSV records:
Option A
Storing each possible item of data in it's own field...
speed, incline, snores
therefore...
15mph, 20%, ,
, , 12
16mph, 20%, ,
14mph, 20%, ,
Option B
Storing each event in its own record...
event, value1...
therefore...
running, 15mph, 20%
sleeping, 12
running, 16mph, 20%
running, 14mph, 20%
Without a specific CSV specification, the consensus seems to be:
Each record "should" contain the same number of comma-separated fields.
Context
There are a number of events which each have a large & different set of data values.
CSV data is to be of use to other developers (I will/could/should/won't use either structure).
The 'other developers' to be toward the novice end of the spectrum and/or using resource limited systems. CSV is accessible.
The CSV format is being provided non-exclusively as feature not requirement. Although, if said application is providing a CSV file it should be provided in the correct manner from now on.
Question
Would it be valid – in this case - to go with Option B?
Thoughts
Option B maintains a level of human readability, which is an advantage say CSV is read by human not processor. Neither method is more complex to parse using a custom parser, but will Option B void the usefulness of a CSV format with other libraries, frameworks, applications et al. With Option A future changes/versions to the data set of an individual event may break the CSV structure (zombie , , to maintain forwards compatibility); whereas Option B will fail gracefully.
edit
This may be aimed at students and frameworks like OpenFrameworks, Plask, Proccessing et al. where CSV is easier to implement.
Any "other frameworks, libraries and applications" I've ever used all handle CSV parsing differently, so trying to conform to one or many of these standards might over-complicate your end result. My recommendation would be to keep it simple and use what works for your specific task. If human readbility is a requirement, then CSV in the form of Option B would work fine. Otherwise, you may want to consider JSON or XML.
As you say there is no "CSV Standard" with regard to contents. The real answer depend on what you are doing and why. You mention "other frameworks, libraries and applications". The one thing I've learnt is "Dont over engineer". i.e. Don't write reams of code today on the assumption that you will plug it into some other framework tomorrow.
I'd say option B is fine, unless you have specific requirements to use other apps etc.
< edit >
Having re-read your context, I'd probably pick one output format and use it, and forget about having multiple formats:
Having multiple output formats is a source of inconsistency (e.g. bug in one format but not another).
Having multiple formats means more code that needs to be
tested
documented
supported
< /edit >
Is there any reason you can't use XML? Yes, it's slightly more difficult to parse, at least for novices, but if so they probably need the practice. File size would be much greater, of course, but it's compressible.

Validate DataGridColumn cells individually

How can I validate the cells in a DataGridColumn individually? (ActionScript 3.5) The validation is configured per-cell, based on fields in the given row. For example
FIELD VALUE TYPE
age 13 Integer
height 13x3 Integer
registered true Boolean
temperature 98.G6 Float
In this case, of course 13x3 and 98.G6 would be invalid.
It's easy to write a Validator ; and to access the data provider objects.
But how do I get individual access to the GUI cell objects so I can set the errorString on an individual cell, either directly or through a Validator?
The itemRenderer/ TextInput control is re-used across the cells for performance reasons, so accessing the GUI-level objects is tricky.
Edit
Answers:
One way to validate and display the invalidation markings, but not per-cell, is to validate all data-provider objects and then set the errorString on the entire grid.
One way to validate per-cell is on the itemEditEnd event handler. (See these pages A B C D). One disadvantage is that it only allows access to the cells from the "inside", not in an action that validates the grid on command.
A custom itemRenderer is another possibility, as in the answer below, but like 3 above, it only allows access to the cells from the "inside", not in an action that validates the grid on command.
See Richard Haven's answer below.
And here's how to access the GUI objects: The list of relevant GUI objects is a protected field; so you can access it by subclassing, then iterate over the GUI-components which represent the cells and set the errorString on each one.
This website at BigResource asks how to access an individual cell. The third post answers there question and provides a link to a better resource than this. Figured you would want both. Hopefully this helps.
If you are looking for arbitrary validation (e.g. on a button or page navigation) rather than immediate navigation (e.g. on cell exit or end-of-edit), then the data is in the underlying dataProvider. I would do validations there rather than dig around inside the grid.
You can add a flag to the data item so the item renderer displays it as an error (or use an external list to flag it).
Cheers
Are you sure you actually want to access the individual cells' DisplayObjects? The component manages instances so that it only creates as many as it needs to display (so that huge datasets don't require a huge number of DisplayObjects on screen).
I think a better alternative would be to provide your DataGridColumn with a custom itemRenderer. You can write this class to accept a validator and update its appearance, and there are a bunch of great tutorials around about that.