SuiteScript 2.0 Estimate Not Updating - suitescript2.0

I am trying to null out a custom numeric field on an estimate. The code I am using is;
record.submitFields({
type: record.Type.ESTIMATE,
id : idNext,
values : {
fieldID: null
}
});
It wasn't updating so I changed the value to 0 instead of null and it's still not updating the field. The field id matches to a field id on the estimate, the estimate id matches an internal is of an estimate??
Please help.

try this
record.submitFields({
type: record.Type.ESTIMATE,
id : idNext,
values : {
fieldID: ''
}
});

Related

Sequlize Query get last added value

I am using Sequlize. I have a table status_config in this table I have a column create_time as timestamp( 2021-06-02 12:04:52.293977). Now I need to query on this table and get the latest value created on this table.
status_config.findOne({ where: created_time **need to implement here to get last added value})
We can use order by [['createdAt', 'desc']]
let last_status_config = await status_config.findOne({
order:[['createdAt', 'desc']]
});
console.log(JSON.parse(JSON.stringify(last_status_config)))
Output
{ id: 19, name: 'test_last', password: null, confirmation: null }

Query from a table to get a JSON result

I have a table
I'd like to get the JSON result like this:
[
{
"Type":"I", //If group name is empty display ‘I’ otherwise, display ‘G’
"StartDate":"20/12/2020 8:00am", //This is the start time
"Additional":{ //Because it is non-group (GroupName is null), so Additional is an object
"Info":"having food"
}
},
{
"Type":"G", //Group by Date and Group Name.
"GroupName":"School", //If record has the same group name,
"StartDate":"20/12/2020 9:00am", //!!! Display the first entry’s start date
"Additional":[ // It is an array due to Group Name being a real value, the items in array is the record whose StartDate has the same Date value.
{
"StartDate":"20/12/2020 9:00am", //Display the start date
"Info":"Take bus"
},
{
"StartDate":"20/12/2020 9:30am",", //Display the start date
"Info":"On the beach"
}
]
},
{
"Type":"G",
"GroupName":"Class 1",
"StartDate":"20/12/2020 11:00am",
"Additional":[
{
"StartDate":"20/12/2020 11:00am",
"Info":"Restaurant "
},
{
"StartDate":"20/12/2020 13:00pm",
"Info":"Walk on Lane"
}
]
},
{
"Type":"I",
"StartDate":"20/12/2020 15:00pm",
"Additional":{
"Info":"In museum"
}
}
]
Would any one help me on this? Thank you so much.
I also attach the JSON data in this picture so the JSON format would be clearer.
There is a typo sorry, this is the new picture:
As per Microsoft SQL Server documentation, FOR JSON, will work best for you. It is supported on SQL Server 2016 and above.
SELECT CASE
WHEN GroupName is null THEN 'I'
ELSE 'G'
END as Type
,GroupName
,StartDate .....
FROM table
FOR JSON AUTO;
https://learn.microsoft.com/en-us/sql/relational-databases/json/format-query-results-as-json-with-for-json-sql-server?view=sql-server-ver15
When you form a JSON structure. Better to use with "INCLUDE_NULL_VALUES". So that it will have NULL for attribute If the value is missing.
SELECT Column1, Column2,... FROM Table FOR JSON AUTO, INCLUDE_NULL_VALUES

Creating dropdown and populating unique value in Vue js

I am very new to Vue js. We are displaying a table on UI having 4 columns as
S.No | Column | Description | Type
We need to list all the unique value in Type in a drop-down (describing the datatype of a column), I am able to make Type as a drop-down however struggling to get the list of unique values in Type.
I am getting all data in an Array [sno:(..), column:(..), description:(..), type:(..)] and I am trying to get to type to put the value in one of the array and the taking unique value from that.
The code I tried first is
this.columnType = this.columnData.filter(data => {return data.type.toUpperCase()});
Also, I tried the following but it is just filtering on the specific datatype in this case "Timestamp"
this.columnType = this.columnData.filter(function(data) {
return data.type.toUpperCase() == "TIMESTAMP_NTZ"
});
Looking for some guidance to get this right.
Thanks in advance to all for helping
Use the following computed property to get the list of unique Type values:
computed:
{
onlyTypes()
{
// we want an Array with all the Type values
return this.tableDataRows.map(dataItem => dataItem.type);
},
uniqueTypes()
{
// we want only the unique Type values
return this.onlyTypes.filter((value, index, self) => self.indexOf(value) === index);
}
}

Do I need Indexing required in case of less data returned by DynamoDb

Say, the dynamo db has data of format:-
{
"id":"<id>",
"field-1":"<field-1-value>",
"field-2":"<field-2-value>",
"field-3":"<field-3-value>",
"field-4":"<field-4-value>",
"metadata":{
"subfield-1":"<subfield-1-value>",
"subfield-2":"<subfield-2-value>"
}
}
So, I have a partition key on id column and sort key on field-1 say. Now, say, I have a requirement that for the same id, if we want a search capability on subfield-1 value, so can that be easily done in Dynamo Db without creating any index. The max. number of rows that would be there for each id would be 70. So, looks like a small set of data.
Please let me know your views.
Yes, this can be achieved without index. You can use FilterExpression to filter the data i.e. metadata.subfield-1.
Example:
var params = {
TableName : 'yourTableName',
KeyConditionExpression : 'id = :idval',
FilterExpression : '#metadata = :subField1Val',
ExpressionAttributeNames : {
'#metadata' : 'metadata.subfield-1'
},
ExpressionAttributeValues : {
':idval' : '7',
'subField1Val' : 'somevalue'
}
};

Lookback API remove unauthorized snapshots

When I ran into issues with a query to the lbapi, I took a step back a created a very basic app with just the query in it that logged the results.
It looked something like this:
Deft.Chain.pipeline([
function() {
var dd = Ext.create('Deft.Deferred');
Ext.create('Rally.data.lookback.SnapshotStore', {
fetch : ['Parent', 'Feature'],
filters : [{
property : '__At',
value : 'current'
},{
property : '_TypeHierarchy',
value : 'HierarchicalRequirement'
}]
}).load({
params : {
compress : true,
removeUnauthorizedSnapshots : true
},
callback : function(store) {
console.log('store',store);
dd.resolve(store);
}
});
return dd.promise;
}
]).then({
success: function(records) {
console.log('records', records);
}
});
Strangely, if I added a filter like this:
{
property : 'Parent',
operator : '!=',
value : null
}
I got more results. I concluded that the removeUnauthorizedSnapshots must filter the results after they have all been gathered into a page of 20000 results, and thus this would be possible. Can anyone confirm this? Hopefully such confusion can be avoided in the future
You are correct.
removeUnauthorizedSnapshots filters the current pagesize set of results, which means it might actually return a page with 0 results in an extreme case when all results are or were once associated with projects that the user is not allowed to access.
I am not sure about the outcome when you got more results. Additional filter should only limit the number of results further, and I see further reduction when I use a similar code.
But I would like to suggest a syntax change for the filter on Parent property. Nulls are not storied in Lookback API at all, so any != null or == null queries are a little misleading. In your code it works, but in the case of Parent == null, it will return snapshots that don't have a Parent attribute, not just those that have a Parent attribute that is null. You may use exists true instead of != null
filters : [
{
property : 'Parent',
operator : 'exists',
value : true
},{
property : '__At',
value : 'current'
},{
property : '_TypeHierarchy',
value : 'HierarchicalRequirement'
}]