isnull

How do I handle empty number fields/variables in Crystal Reports?

青春壹個敷衍的年華 提交于 2019-12-25 03:26:08
问题 I have the following formula in my group footer, but am having problems with displaying 0 if sample_perc is empty; this value gets empty if #rt_sample_ordered is blank. NumberVar sample_perc := {#rt_sample_ordered}%{@sum_of_sample}; if (sample_perc>0)then sample_perc else 0 How do i print 0 when sample_perc is blank? 回答1: If Isnull({#rt_sample_ordered}) Or Isnull({@sum_of_sample}) Then 0 Else If ( {#rt_sample_ordered}%{@sum_of_sample} ) > 0 Then sample_perc Else 0 来源: https://stackoverflow

Entity Framework Linq Is Null, Is Not Null Issue

99封情书 提交于 2019-12-24 20:40:15
问题 I have a method that receives a category id, followed by two optional string parameters that default to null. I tried using a few similar answers from other questions on SO but sofar none have helped. I am trying to get the linq to EF query to work as follows: If either optional parameter has a value, use the value otherwise use an Is Null. If both optional parameters are present use these as part of the query or either one if only on eis supplied. But if no parmeters are added, just use the

!is_null() not working as expected

馋奶兔 提交于 2019-12-24 10:57:01
问题 dispatch_address_postcode isn't mandatory and it will still run even if it's blank: if (!is_null($_POST['personal_info_first_name']) && !is_null($_POST['personal_info_surname']) && !is_null($_POST['personal_info_email']) && !is_null($_POST['personal_info_telephone']) && !is_null($_POST['dispatch_address_country']) && !is_null($_POST['dispatch_address_first_name']) && !is_null($_POST['dispatch_address_surname']) && !is_null($_POST['dispatch_address_address']) && !is_null($_POST['dispatch

Null substitution in SQLite:

久未见 提交于 2019-12-23 12:19:06
问题 In Sybase and MSSqlServer TransactSQL, we have a function IsNull(columnName,valueForNull) to return a typed default value when a column value is null. How can I replicate this functionality in SQLite? Example in TransactSQL: select IsNull(MyColumn,-1) as MyColumn from MyTable If MyColumn is null, this expression will return -1 as the value of MyColumn. Want to do something similar in SQLite. (Yes, I know I can write my own wrapper function to handle this - that's not the answer I'm looking

Where Clause Rejecting Rows if NULL occurred

元气小坏坏 提交于 2019-12-23 11:55:04
问题 A Theory Question... When a set of queries as given below is fired then... Create table Temp1(C1 varchar(2)) Create table Temp2(C1 varchar(2)) insert into Temp1 Values('A'),(NULL),('B') insert into Temp2 Values('B'),(NULL),('C'),(NULL) select *from Temp1 A,Temp2 B where A.C1 <> B.C1 ...gives... I used A.C1 <> B.C1 in the Where clause. But I expect... To get expected result as output I needed to use ISNULL(A.C1,'') <> ISNULL(B.C1,'') in the Where clause. My Question is why do I need to use

Truncation issue with ISNULL function in SQL Server

百般思念 提交于 2019-12-22 15:53:46
问题 Recently I faced an scenario where ISNULL function is returning me truncated data if the first string is null. ISNULL(a, b); I found the a is 5 chars and b is 10 chars but when a is null it will return only 5 chars of b and not full length. Is this a known issue? 回答1: It is a known behaviour From MSDN The value of check_expression is returned if it is not NULL; otherwise, replacement_value is returned after it is implicitly converted to the type of check_expression, if the types are different

Truncation issue with ISNULL function in SQL Server

a 夏天 提交于 2019-12-22 15:53:09
问题 Recently I faced an scenario where ISNULL function is returning me truncated data if the first string is null. ISNULL(a, b); I found the a is 5 chars and b is 10 chars but when a is null it will return only 5 chars of b and not full length. Is this a known issue? 回答1: It is a known behaviour From MSDN The value of check_expression is returned if it is not NULL; otherwise, replacement_value is returned after it is implicitly converted to the type of check_expression, if the types are different

JPA: Left join not working with “is null” in where clause

时光怂恿深爱的人放手 提交于 2019-12-22 08:17:38
问题 I am using EclipseLink (2.4, 2.5 and 2.6) on a very simple project where I have a Department entity and each Department links to an Employee entity which is the manager of the Department . I am currently unable to make this simple query work: select d from Department d where d.manager is null Returns 1 row select d from Department d left join fetch d.manager where d.manager is null Returns 0 row I am using Eclipselink over an H2 database. The SQL query generated does not seem to create a left

Check if array value isset and is null

烂漫一生 提交于 2019-12-21 06:58:46
问题 How to check if array variable $a = array('a'=>1, 'c'=>null); is set and is null. function check($array, $key) { if (isset($array[$key])) { if (is_null($array[$key])) { echo $key . ' is null'; } echo $key . ' is set'; } } check($a, 'a'); check($a, 'b'); check($a, 'c'); Is it possible in PHP to have function which will check if $a['c'] is null and if $a['b'] exist without "PHP Notice: ..." errors? 回答1: Use array_key_exists() instead of isset() , because isset() will return false if the

C# equivalent of the IsNull() function in SQL Server

大兔子大兔子 提交于 2019-12-20 08:19:33
问题 In SQL Server you can use the IsNull() function to check if a value is null, and if it is, return another value. Now I am wondering if there is anything similar in C#. For example, I want to do something like: myNewValue = IsNull(myValue, new MyValue()); instead of: if (myValue == null) myValue = new MyValue(); myNewValue = myValue; Thanks. 回答1: It's called the null coalescing ( ?? ) operator: myNewValue = myValue ?? new MyValue(); 回答2: Sadly, there's no equivalent to the null coalescing