Flutter, get text from intl from a function - flutter

I'm trying to get language from json, so i got a function who check if i have the key and return the text.
If i don't, i want to load text from intl/l10n.
The probleme is that i give the key as parameter and that works fine for the json as json[key] but for l10n, i need to give the real name for S.of(context).title, if i try to do S.of(context).key ,it says that that key it is not defined for the type S.
is there any way to do it, of course i want to use this function many time that is why i tried to go with dynamic value.
thanks

Related

how to correctly use Firebase.Firestore.FieldValue.ServerTimestamp in unity?

Currently, I was working on a Unity project and using Firestone as my database.
now i facing a problem is when i create a document in firestone i want to add the time of creation also.
i was using the code
db.Collection("Challenges").Document(addedDocRef.Id).UpdateAsync("TimeCreated", Firebase.Firestore.FieldValue.ServerTimestamp);
but it always update the same time in firestone.
every document get same timestemp, can anyone teach me how to solve this issue?
The FieldValue properties are sentinel values in this case to be understood as dummy values that are supposed to be filled in by "someone".
I don't know how Firebase works exactly and who is supposed to fill this in but what you get basically equals DateTime.UnixEpoch the default uninitialized system time (+ 7:30 timeszone shift). It might have to be configured accordingly somewhere before it works correctly.
You could instead simply pass in your own timestamp using e.g. DateTime.Now

Auto complete in text field in odoo

I would like to select a customer from the select box by start typing its phone number.
How can I do that?
I have seen some are using name_search method.But still i am confused how to use it in both front end and back end.
Or is there any other solution for this.
Override the name_search method of your model and the domain you want on the args variable. Take a look at addons/account/account.py around line 595 args += [('type', '=', type)] for a concrete implementation. Make sure that you return the appropriate data structure as documented in the method's docstring at openerp/models.py.
For Auto complete in odoo. It provides suggestion only in case of using Many2one field in any module.
If you want to show suggestion and autocomplete. Create a model to store the mobile numbers and then use that particular model as foreign key in existing model.
That will do for you.

Parse setting explicit type using REST

I know you can set a Date field explicitly like so:
"date_brewed":{
"__type":"Date",
"iso":"2009-10-15T00:00:00.000Z"
}
But is there anyway to explicitly set the column type of 'Number' using REST? For instance, I'd like to set the column 'batch_size' to a Number instead of a string but when POST'ing via rest it keeps getting created as a string type column.
Meh, this was more of a Perl issue than a Parse issue.
What I had to do to tell Perl to treat the number like an actual number was to add a zero to the value. :/

Is there a way in the AtTask API to get every project where a custom field is not null?

I want to search for a project where a custom field is not null. Something like this:
GET /attask/api/project/search?status_mod=notnull&&DE:Custom Field_mod=notnull
I see it's working for normal fields, but when I try this for a custom field it's crashing, when I extend the field with _mod.
I'm a bit late on this but have you tried something like this?
GET /attask/api/project/search?status_mod=notnull&DE:Custom Field=0&DE:Custom Field_mod=notnull?
You usually need to give it a value before you try to modify the value from what i understand.
You can use below request url
GET attask/api/project/search?apiKey=xxxxx&status_mod=notnull&categoryID_Mod=notnull
It will return all project which contains custom_fields(part of category)
GET attask/api/project/search?apiKey=xxxxx&status_mod=notnull&DE:Custom Field_Mod=notnull
you need to use "_Mod" (M in caps) with any custom_field which should be present on Workfront.

Get statuscode text in C#

I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.