How To Fill addressInfos object in self.Self object - bixby

I am trying to get the user's set home address from their profile. When testing on device, am consistently seeing it empty when it is set in the profile.
Here is the action used to extract the information:
action (ReturnSelfAddress) {
type (Constructor)
description (Gets address from profile)
collect {
input (mySelf) {
min (Required)
type (self.Self)
}
}
output (geo.SearchTerm)
}
This goes along with a javascript file that extracts the home address from the self.addressInfos field.
Here is a screenshot of my profile on the device:
And another of the address.
In testing I was using a real address.
The resulting self object I got from the profile was:
{
addressInfos = [],
birthdayInfo = {
calculatedFromNow = null,
day = 1,
fuzzyFactor = null,
holiday = null,
month = 1,
namedDate = null,
parseTree = null,
year = 1911,
$id = null,
$type = viv.contact.BirthdayInfo
},
contactId = null,
emailInfos = [{
address = fake#fake.com,
emailType = Home,
$id = null,
$type = viv.contact.EmailInfo
}],
isFavorite = null,
nameInfo = {
firstName = Bill,
initial = null,
lastName = Faker,
middleName = null,
nickName = ,
prefix = null,
structuredName = Bill Faker,
suffix = null,
$id = null,
$type = viv.contact.NameInfo
},
phoneInfos = [],
photoInfo = {
caption = null,
dimensions = null,
rotation = null,
size = null,
subtitle = null,
title = null,
url = http://image.to.be.put/here,
$id=null, $type=viv.contact.PhotoInfo
},
relationshipInfos=[],
workInfo=null,
$id=null,
$type=viv.self.Self
}
As you can see the addressInfos array is empty. How should I access the user's profile addresses?
EDIT:
The personal information here is dummy data I made up so I wouldn't have to share my actual email, birthday, phone number etc... When actually testing this on my device, all of this information matches my real developer account.

viv.self.Self is linked to Samsung account.
On device, Settings -> Upper right corner, you will be able to edit your Samsung account.
I've just added a work address, and able to access it using the following JS code.
module.exports.function = function displayProfile (self) {
console.log(self)
if (self)
return 'lable = ' + self.addressInfos[0].label + ' address = ' + self.addressInfos[0].address.unstructuredAddress;
else
return 'Not self';
}
Current IDE is able to fetch these info from your Samsung account, so you can test without on-device testing. Of course, I've also tested on device after private submission, and it works fine.

Please double-check that you have an address filled out in your Samsung account:
https://www.samsung.com/us/support/account/info/

Related

Terraform, get value from map

Prompt me, please, how can I get separately a value for key paswd-0. I mean, I need separated values for password and username.
This is remote data from data.terraform_remote_state.user_passwd.outputs.login_passwd
output = {
paswd-0 = jsonencode(
{
password = "uGo="
username = "git"
}
)
paswd-1 = jsonencode(
{
password = "wM="
username = "kun"
}
)
}
I'm trying this and get error parameter: lookup() requires a map as the
output "tetts" {
value = lookup(tomap(data.terraform_remote_state.user_passwd.outputs.login_passwd.paswd-0), "password", null)
}
Ideally I would go through of each value and fill these fields.
argocd_repositories = {
[
"private-repo" = {
url = "https://repo.git"
username = "argocd"
password = "access_token"
},
"git-repo" = {
url = "https://repo.git"
password = "argocd_access_token"
username = "admin"
},
"private-helm-chart" = {
url = "https://charts.jetstack.io"
type = "helm"
username = "foo"
password = "bar"
},
]
}
As per my comment, you can get the value from the data source by using the jsondecode built-in function [1]. You would have to update the output to look like the following:
output "tetts" {
value = lookup(tomap(jsondecode(data.terraform_remote_state.user_passwd.outputs.login_passwd["paswd-0"]), "password", null)
}
This is only to make it work as you intended it to. However, it will output only the value for the password. Since I do not have the remote state, I managed to get close to what you want with locals and the following:
locals {
output = {
paswd-0 = jsonencode(
{
password = "uGo="
username = "git"
}
)
paswd-1 = jsonencode(
{
password = "wM="
username = "kun"
}
)
}
sorted_values = { for k, v in local.output : jsondecode(v).username => jsondecode(v).password }
}
Note that jsondecode is used on the values of the original map. Furthermore, since the JSON decoded values are also in a key value pair format, you can access the keys and corresponding values using the usual terraform notation (i.e., jsondecode(v).username and jsondecode(v).password). Using terraform console, the local sorted_values variable has the following look:
> local.sorted_values
{
"git" = "uGo="
"kun" = "wM="
}
I guess this is close to what you wanted to achieve with the tomap function.
[1] https://www.terraform.io/language/functions/jsondecode

Exporting FileAttachment using Acumatica WebService

I am trying to get activities for cases from different instance with all File Attachments and Notes attached to the activities. I have tried with different ways, but unfortunately none of them has worked. Can anyone please suggest what is the best way to get all file attachments and notes for the Case Activities using Acumatica WebService.
Here is the code which I tried--
SP203010WS.Content content = context.GetSchema();
export = context.Export
(
new SP203010WS.Command[]
{
new SP203010WS.Value
{
LinkedCommand = content.Case.CaseID,
Value = currentCaseNo
},
content.Activities.Type,
content.Activities.Summary,
new SP203010WS.Field { FieldName="Body", ObjectName="Activities"},
content.Activities.StartDate,
content.Activities.CreatedBy,
new SP203010WS.Field { FieldName="NoteID", ObjectName="Activities"},
content.Activities.CreatedAt,
new SP203010WS.Field
{
FieldName = content.Activities.ServiceCommands.Attachment.FieldName,
Value = content.Activities.ServiceCommands.Attachment.Value,
LinkedCommand = content.Activities.ServiceCommands.Attachment
},
new SP203010WS.Attachment
{
FieldName = content.Activities.ServiceCommands.Attachment.FieldName,
Value = content.Activities.ServiceCommands.Attachment.Value
},
new SP203010WS.Value
{
FieldName = content.Activities.ServiceCommands.Attachment.FieldName,
Value = content.Activities.ServiceCommands.Attachment.Value,
LinkedCommand = content.Activities.ServiceCommands.Attachment
},
},
new SP203010WS.Filter[]
{
new SP203010WS.Filter
{
Field = content.Activities.StartDate,
Condition = SP203010WS.FilterCondition.Greater,
Value = maxStartDate
}
},
0, true, true
);
Check out the documentation for I200 (screen-based Web Services) pages 75-76. First, you have to get the list of file names, and then loop through each one to get the actual attachments.

adding an assign function as property to an object in NodeJs

for the sake of fun and exploring nodeJS I made an object
var f15c = {
fuel : 10000,
IRST: true,
AESA: true,
speed: 2500,
Ammo:
{
AMRAAM: 6,
Python5: 2,
Delilah: 3,
},
tailnumber : the question begins here.
}
The problem came when I wanted to add tailnumber that is not the same for every plane but should be assigned to the plane.
what is the methode?
var f15c = {
...
tailnumber = function (tn){"whats should i add here?"}
}
or
var f15c = {
...
tailnumber: ?? what should i place here?
SetTailNumber = function(tn)
{
tailnumber=tn;
}
}
or must I have the entire F15c as a function?
var f15c = function(tn) {
...
tailnumber = tn;
but then i cannot set the entire variables complex.
or perhaps I'm doing it wrong and should refer the variable as an individual F15 and use a different function to create it?
but then how do I make that field in a way it is unassigned and waiting to be assigned (and then saves the assigned number)?
would appreciate some heads up
The secret is to use this to refer to a property of the own object
var f15c = {
...
tailnumber: null,
setTailNumber : function(tn)
{
this.tailnumber=tn;
}
}
Then:
f15c.setTailNumber(1234);
console.log(f15c.tailnumber);
Do you mean you want to set a value to a property?
var f15c = {
_tailnumber: 0,
set tailnumber(newtailnumber) {
this._tailnumber = newtailnumber;
},
get tailnumber() {
return this._tailnumber
}
};
f15c.tailnumber = "304";
console.log(f15c.tailnumber);
console.log(f15c);

Acumatica get Sales Order by Customer Order field

I am attempting to retrieve a single sales order based on the Customer Order field in Acumatica with the Contract Based API. See my code below, which I based off of code in the Contract Based Documentation (page 82).
public SalesOrder GetSalesOrder(string orderNumber)
{
var binding = new System.ServiceModel.BasicHttpBinding()
{
AllowCookies = true,
MaxReceivedMessageSize = 655360,
MaxBufferSize = 655360,
SendTimeout = new TimeSpan(0, 2, 0)
};
var soToBeFound = new SalesOrder()
{
OrderType = new StringValue { Value = "SO" },
CustomerOrder = new StringValue { Value = orderNumber }
};
var address = new System.ServiceModel.EndpointAddress(ConfigurationManager.AppSettings["AcumaticaUrl"]);
using (DefaultSoapClient client = new DefaultSoapClient(binding, address))
{
client.Login(_acumaticaUid, _acumaticaPwd, _acumaticaCompany, null, null);
var existingOrder = (SalesOrder)client.Get(soToBeFound);
client.Logout();
return existingOrder;
}
}
When I execute this code I get this exception:
The request channel timed out while waiting for a reply after
00:01:59.9880722. Increase the timeout value passed to the call to
Request or increase the SendTimeout value on the Binding. The time
allotted to this operation may have been a portion of a longer
timeout."
As you can see, I've already increased the timeout to 2 minutes, which seems like forever. Is the Acumatica API really just this slow? Or am I doing something wrong in code?
EDIT:
When I try to get by the "OrderNbr" field instead of "CustomerOrder" field, it works perfectly. Is getting by "CustomerOrder" not allowed in this way? If not, how can I use "CustomerOrder" in a get request?
When you do search via the Contract-Based API, it's required to assign instance of the [FieldType]Search type instead of [FieldType]Value to all fields used in search criteria (StringSearch must be used instead of StringValue in your case):
var soToBeFound = new SalesOrder()
{
OrderType = new StringSearch { Value = "SO" },
CustomerOrder = new StringSearch { Value = orderNumber }
};
Just to confirm, StringSearch is also used in the sample on page 82 from the Contract Based documentation.

ReSharper chop if long not working

I have the following code that when I run autoformat in ReSharper doesn't not get changed.
I thought Chop if long would cause a chop to occur if the right margin is exceeded.
If I turn on Chop always I get this.
This works, but I would rather not chop short statements like the first, which is what I assume Chop if long means.
Ideas?
Here are my ReSharper settings.
Turning on wrap long lines makes things even worse.
UPDATE1:
Here is the email I sent to JetBrains support.
The believe the central issues I'm facing is I understand the "chop always" setting, but I do not understand "chop if long" or "simple wrap". I have not found any documentation on what these settings mean, so I'm going off what I believe should be happening.
I am setting the "Wrap object collection and initializer".
Chop Always:
cdata.GetByIdData = new Category {
Id = "123",
Name = "category"
};
vdata.GetByIdData = new Vendor {
Id = "456",
Name = "vendor"
};
adata.GetByIdData.Add(new Account {
Id = "789",
Name = "account",
Balance = 5000
});
svc.ExecuteRequest(new AccountTransactionService.Add {
Kind = AccountTransaction.KIND_DEBIT,
Source = "789",
Destination = "dst",
Date = new DateTime(2011, 1, 1),
Categories = new List<AccountTransactionService.CreateCategory> {
new AccountTransactionService.CreateCategory {
Id = "123",
Amount = 200.50m
}
}
});
Chop If Long:
cdata.GetByIdData = new Category { Id = "123", Name = "category" };
vdata.GetByIdData = new Vendor { Id = "456", Name = "vendor" };
adata.GetByIdData.Add(new Account { Id = "789", Name = "account", Balance = 5000 });
svc.ExecuteRequest(new AccountTransactionService.Add { Kind = AccountTransaction.KIND_DEBIT, Source = "789", Destination = "dst", Date = new DateTime(2011, 1, 1), Categories = new List<AccountTransactionService.CreateCategory> { new AccountTransactionService.CreateCategory { Id = "123", Amount = 200.50m } } });
I would expect Chop If Long to look like this given a margin of 80:
cdata.GetByIdData = new Category { Id = "123", Name = "category" };
vdata.GetByIdData = new Vendor { Id = "456", Name = "vendor" };
adata.GetByIdData.Add(new Account { Id = "789", Name = "account", Balance = 5000 });
svc.ExecuteRequest(new AccountTransactionService.Add {
Kind = AccountTransaction.KIND_DEBIT,
Source = "789",
Destination = "dst",
Date = new DateTime(2011, 1, 1),
Categories = new List<AccountTransactionService.CreateCategory> {
new AccountTransactionService.CreateCategory {
Id = "123",
Amount = 200.50m
}
}
});
"Chop if long" works only when you turn on "Wrap long lines" option, so you should turn it on. I guess that http://youtrack.jetbrains.com/issue/RSRP-291146 prevented you from getting the formatting you wanted with "Wrap long lines" turned on. Well, it should be fixed in ReSharper 7.1 EAP - try and write us if you still have problems.
Change "Wrap object collection and initialisers" to "Simple Wrap", that should style your code in the way you want it to.
Unfortunately, I can't look up what Chop if long is supposed to do as the Resharper community site is blocked from work for some strange reason.
There is an issue logged with JetBrains that is depicting the same behavior you describe...
http://youtrack.jetbrains.com/issue/RSRP-291146

Resources