OR condition in SSRS - reporting-services

Is this code:
IIF(Fields!XXX.Value = "0" OR ISNOTHING(Fields!XXX.Value), TRUE, FALSE)
The same as:
IIF(Fields!XXX.Value = "0", TRUE, IIF(ISNOTHING(Fields!XXX.Value), TRUE, FALSE))
Will the first method work or only the second method for SSRS?

Both are equivalent and will work

Related

Spring JPA Mysql json_set boolean saving as 1/0

Currently we have a table with a column in json datatype. That stores
{
"newTicketLowInd": false,
"newTicketHighInd": false,
"newTicketMediumInd": false,
"newTicketUrgentInd": false,
"becomeTicketOwnerInd": false
}
and I wanted to add a new element with default value of true. Thus
#Modifying
#Query("update UserSettings u set u.jsonCol = json_set(u.jsonCol , '$.newElement', :indicator)")
void bulkUpdateTicketConversationUpdateMyselfInd(#Param("indicator") boolean indicator);
Or in MySQL
update UserSettings u set u.jsonCol = json_set(u.jsonCol , '$.newElement', true)
But it is storing boolean value as 1/0.
{
"newTicketLowInd": false,
"newTicketHighInd": false,
"newTicketMediumInd": false,
"newTicketUrgentInd": false,
"becomeTicketOwnerInd": false,
"newElement": 1
}
How can I store it as true or false? the same as the current elements stored.
I just used nativeQuery in jpa
#Query(nativeQuery = true, value = "update user u set u.email_notification_settings = json_set(u.email_notification_settings, '$.ticketConversationUpdateMyselfInd', true)")

Using filter() on a mapped array of objects but with omitting the data used for filtering

I have the following mapped array of objects on which I'm Using filter(). It is a list of TO DO tasks, from which I want to filter out only tasks that haven't been done yet, but without the false value indicating they haven't been done yet). In other words, I just want to display the tasks themselves, if indeed, they weren't done yet.
The purpose of the code is learning on a good way to omit that data (false) declaration from the filtered content.
let todos = [
{
todo: 'Buy apples',
done: false
},
{
todo: 'Wash car',
done: true
},
{
todo: 'Write web app',
done: false
},
{
todo: 'Read MDN page on JavaScript arrays',
done: true
},
{
todo: 'Call mom',
done: false
}
];
I tried:
unfinishedTasks = todos.map( (e)=> e).filter( (e)=> e.done == false);
as well as:
unfinishedTasks = todos.filter( (e)=> e).map( (e)=> if ( e.done == false ) {e.todo} );
The first outputs basically correct - the false todo's are there, but with the false keyword near them - the keyword I'd like to omit, of course:
[{"todo":"Buy apples","done":false},{"todo":"Write web app","done":false},{"todo":"Call mom","done":false}]
The second outputs:
Unexpected token "if".
What I desire (ommiting the false keyword from the output):
["Buy apples", "Write web app", "Call mom"]
I run the code in teamtreehouse.com execution snippet. To test it there, one must be a registered Treehouse student.
I might need to use another filter() on the filtered content, or using some if-than statement? I don't have a clue.
First filter by item.done, then map to item.todo:
const todos = [{ todo: 'Buy apples', done: false }, { todo: 'Wash car', done: true }, { todo: 'Write web app', done: false }, { todo: 'Read MDN page on JavaScript arrays', done: true }, { todo: 'Call mom', done: false } ];
const out = todos
.filter(item => !item.done)
.map(item => item.todo);
console.log(out); // ["Buy apples", "Write web app", "Call mom"]

Selected row not highlighted in jqgrid

I have written the function for row selection.It is not highlighting the selected row(sometimes highlighting sometimes other row highlighted) and not displaying the icons the way I have written it. following is the code
multiselect : true,
iconSet: "fontAwesome",
datatype : "json",
loadonce : true,
rowNum : 10,
rowList : [ 10, 20, 30 ],
toppager:true,
pager : '#prowed1',
sortname : 'id',
viewrecords : true,
sortorder : "asc",
editurl : "editGrid.html",
onSelectRow : function(rowId) {
var rowId = jQuery("#list1").jqGrid('getGridParam',
'selarrrow');
if (rowId.length > 1) {
$("#list1_iledit").addClass('ui-state-disabled');
}
},
$("#list1").jqGrid(
"navGrid",
"#prowed1",
{
cloneToTop:true,
formatter : "checkboxFontAwesome4",
addicon:"fa fa-plus ",
add : true,
delicon:"fa fa-trash",
del : true,
searchicon:"fa fa-search",
search : true,
refreshicon:"fa fa-refresh",
refresh : true,
editicon:"fa fa-edit ",
edit : true,
saveicon : 'fa fa-floppy-o',
save : true,
},`{ // edit options
afterSubmit : function() {
location.reload(true);
},
beforeShowForm : function(form) {
$("td .navButton navButton-ltr").hide();
},
closeAfterEdit : true
},
{ // add options
beforeShowForm : function(form) {
$("#buName").removeAttr("readonly");
},
closeAfterAdd : true,
clearAfterAdd : true
},
{ // del options
serializeDelData : function(postdata) {
return {
'buName' : $('#list1').jqGrid('getCell',
postdata.id, 'buName'),
'oper' : 'del'
}
}
}
);` $("#list1").jqGrid('inlineNav', "#prowed1", {
//cloneToTop:true,
//iconSet: "fontAwesome",
add : false,
edit : true,
editicon : 'fa fa-pencil-square-o',
save : true,
saveicon : 'fa fa-floppy-o',
editParams : {
aftersavefunc : function(id) {
jQuery('#list1').jqGrid('setSelection', id, false);
},
},
});`
You should provide the demo, which reproduce the problem. The reason of the most problems with highlighted: wrong input data or wrong colModel. Every row of jqGrid have always id attribute (rowid), which should be part of input data: see here. The id value must be unique. If you have id duplicates then you could problems with selection/highlighting of rows.
If you fill the data from the database than you can use native ids from the tables of the database to build unique rowids. Database tables don't allow id duplicates too.
To be able to edit the data in the database you will need to identify the edited data. Such unique value could be used as the rowid. If you fill the grid by JOIN from multiple tables, than composed id could be used. For example, if you fill the the grid with the data from two tables User and Location then the paar (user_id, location_id) are unique. If both user_id and location_id are numbers, then you can use user_id + "_" + location_id as rowid. The value will be sent to the server during editing and you will have full information to find the data in the tables, which need be modified.
I think that you have problems with unique id in the data. Check that the ids used when you insert data in the grid are unique and you do not have duplicate one.
Kind Regards
In your ColModel make sure the property key:true is only specified once and represents a unique row ID value. See http://www.trirand.com/jqgridwiki/doku.php?id=wiki:colmodel_options
Dumb on my part, but I had the property beforeSelectRow set in the grid code that I had copied from another project. This of course was blocking any selection of a grid row.
beforeSelectRow: function (rowid, e) {
return false;
},

Mysql store boolean that reads to true or false

I'd like to create a column which will contain boolean values, I don't want to use TINYINT(0) and store 0 for false and 1 for true, instead i'd like to store "true" or "false" values but not as VARCHAR values.
I'm doing this because I'm using Extjs, and I'm dynamically creating comboboxes, I need those boolean values to use as parameters like so :
function createComboBox(editable) {
var combo = new Ext.form.ComboBox({
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText: 'Select item...',
selectOnFocus: true,
//...other settings
editable: editable // true or false
});
return combo;
};
And editable would be "true" or "false" (without quotes).
Should I just use a varchar column and remove the quotes in Extjs? Is there a better way?
You could use ENUM('true', 'false') as the column data type.
Use an int and cast it to a boolean (but it is probably not really needed):
var boolValue = !!intValue;

JSON dot notation in jQgrid?

I am using addRowData method to populate my grid. But my current JSON data have another object inside of each object in the JSON data. To make it view in the grid, i followed the notations in the documentation of jQgrid. But that column remain empty.
My Grid definition:
$("#ExpenseTable").jqGrid({
datatype : "local",
mtype : 'GET',
colNames : [ 'Entry ID','User Name', 'Category Name','Date','Amount','Status'],
colModel : [
{name:'expnsId',label:'ID', width:150 ,editable: false},
{name:'userName',label:'NAME', width:150 ,editable: false},
{name:'category.catName',label:'CATEGORY', width:150 ,editable: false},
{name:'date',label:'DATE', width:150 ,editable: false},
{name:'amount',label:'AMOUNT', width:150 ,editable: false},
{name:'status',label:'STATUS', width:150 ,editable: false},
],
pager : '#ExpPager',
rowNum : 10,
rowList : [ 10, 20, 30 ],
sortname : 'invid',
sortorder : 'desc',
viewrecords : true,
autowidth : false,
caption : 'Expenses Details',
onSelectRow : function(expnsId) { dispExpensData(expnsId); }
});
Code used to populate the Grid:
ExpenseDetailsManagement.getexpenseList(function(expRecords){
//for(count = 0; count<expRecords.length; count++){
// expRecords[count].catId = expRecords[count].category.catId;
// expRecords[count].catName = expRecords[count].category.catName;
//}//I am using this for loop to convert the category object
$("#ExpenseTable").clearGridData(true);
$("#ExpenseTable").jqGrid('addRowData', "expnsId", expRecords);
});
The data returned from the server looks like:
Any idea or suggestions about where i am going wrong!!!
If the values from the 'expnsId' column are unique, I'll recommend you to use key:true parameter as a option of 'expnsId' coulmn. Then the value of the column will be used as the row id.
To be able to help you with the dotted column names you should post the JSON data and not the screenshort with "Object" text on the place of the most important information. Probably your main problem can be easy solved with respect of localReader instead of dotted name.
One more small remark. Beause you use label option for all columns you can remove colNames array which will be not used. The option editable: false is default, so you can remove it also. The parameter mtype you can also remove because it will not used for local data.
UPDATED: Sorry the value of the first parameter of addRowData should be do the name of the column with the data like you as do. So I deleted the first paragraph from the first version of my answer.