NULL vs Undefined

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

What is the difference between type Undefined and Null?

 
#2
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

Null for Requst
Undefined  -for any other

 
#3
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

There is a huge difference between them! "Null" is a common type or value that represents the_absence_ of something.While the "undefined" is a value for representing of _existence_ of something but yet not defined, without a certain value.

 
#4
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

While the "undefined" is a value for representing of _existence_ of something but yet not defined, without a certain value.

 
#5
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

When i have to use Null and when Undefined?

 
#6
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

to #5
It's common to happen NULL-values in queries with LEFT JOIN, when the system couldn't find the appropriate records in the right table.
And the value 'Undefined' is usually used in scripts (modules). For example, if you call a function and skip some parameters but use commas then the skipped parameters will be equal 'Undefined' inside the function. Look here:
>> f(1,,3)
>> the second parameter is 'undefined'.

And another sample to consider. Compare the results of "WHERE field = NULL" with "WHERE field = Undefined" when the field contents the NULL and Undefined. In other words, Undefined is equal Undefined because they are the same, but one NULL is not equal another NULL because.. hmm... because they are unknown, absent. But it's true only in queries. In scripts they are equal each other. It's a kind of magic :)

 
#7
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

to (6)
so, i don't have to use NULL, but queries return it to me when "with LEFT JOIN, when the system couldn't find the appropriate records in the right table.", why it doesn't return undefined instead of NULL?

 
#8
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

#7 undefined != NULL
undefined like a pointer to nowhere
NULL like a normally NULL

 
#9
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

#6 Could You comment this:
http://screencast.com/t/T173ci6WvIxG

Doesn't it seem to be contradicting to your words, that "one NULL is not equal another NULL", ha?

 
#10
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

to (7) Because NULL is common for this situation (similar to SQL)
And in some cases the system returns the Undefined to you even in queries, e.g. for empty fields of complex types.

 
#11
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

#8
nothig != nothig
When i have to use nothing and when i have to use notjing?

 
#12
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

#10
U whant to say me, that NULL is not common for 1C, but 1C need to use it?

 
#13
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

to #12
NULL is common for SQL and 1C has a query language similar to SQL so it's no wonder that it has NULL too

 
#14
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

#13
So, i need to use NULL, cause it comes from SQL and i have to use undefined, cause it comes from 1C, why i cant use NULL instead of udefined?

 
#15
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

#14. You may. I have no objection.

 
#16
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

#15
thx! I hope, i can do it!

 
#17
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 1, 2011
Company:

#9
01.11.2011 14:56:35
In english please... you screen with russian words... i don`t undestand )

 
#18
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

#17 this table translated as:
expression               |    value
NULL=NULL             |   true
NULL=Undefined       |   false
Undefined=Undefined |   true

:)

 
#19
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

#18
It is true only in scripts, not in queries. Please fix it or admit your defeat. :)

NULL=NULL | It's false forever!

 
#20
People who like this:0Yes/0No
Just came
Rating: 0
Joined: Nov 2, 2011
Company: EWG

SQL: NULL = NULL | NULL
1C: NULL = NULL | True
Undefined = Undifened | True

 
#21
People who like this:0Yes/0No
Just came
Rating: 1
Joined: Nov 1, 2011
Company:

SQL:
  NULL = NULL  | unknown
1С query:
  NULL = NULL  | false
  Undefined = Undifened | True
1С script:
  NULL = NULL  | true
  Undefined = Undifened | True

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.