× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Let os take null in a field in javascript/JSON/HTML/XML

javascript/JSON a field set to null has a typeof 'object' that are empty
even if it has been defined
otherwise before. You can't do anything with an empty object and code will
break if you try to
treat it as a 'string' or 'number'

HTML doesn't support typeof 'object' in the body section.

XML will see the field as a string 'null'

Without a lot of work-around code null fields in strings or numbers are not
supported.

On Wed, Feb 22, 2017 at 9:35 PM, Raul A Jager W <raul@xxxxxxxxxx> wrote:

A good use of null is employee retirement data (or leaving for any
reason) Usually you do not know when they will leave, so set it to null.
Some will suggest *hival 9999-12-31, and it will work most of the time,
but all current employees will come out if you SELECT * FROM E WHERE
LEAVING >= '2017-01-01' not only the ones that leaved this year.

What should be the water temperature when the tank is empty?



On 02/22/2017 03:00 PM, Charles Wilt wrote:

I disagree...

NULL can be very useful. But, it's often overused and/or misused.

Consider NULL when it has different meaning than a type default (0,
blank/empty, 9999-12-31/0001-01-01)

For example, a column for "Address line 2" is often "optional"; a user may
or may not enter it. But does my application really need to differentiate
between "not entered" and "entered blanks"? Probably not.

Consider "Expiration date", "never expires" is a valid choice. NULL might
used for that. But from a business standpoint, it's probably easier to
simply "never expires" isn't allowed. Instead, we'll allow an expiration
date of 9999-12-31; that's close enough to "never" for most people. Now
perhaps we can use NULL to mean "unknown" - and we need to find out what
that actual expiration should be.

In the Op's case, he needs to differentiate between entered 0 and not
entered. Allow NULL is a reasonable solution. His alternatives
1) Flag field (is just an application defined null-bit)
2) Magic Number, -1 perhaps. Since I suspect the "valid" values for this
field are >= 0. But now instead of checking for NULL, you're checking for
-1.
3) Storing the column as a NOT NULL in it's own table.

Option 3 is usually branded about as a way around allowing NULL in the DB.
But from an application/UI standpoint you still have to deal with NULL
since a record may or may not exist.

NULL isn't really the problem here, it's the limits of the 5250 UI.

The BLANKS keyword I suggested is a possible solution...

Charles



On Wed, Feb 22, 2017 at 8:35 AM, Henrik Rützou <hr@xxxxxxxxxxxx> wrote:

DB null capable fields is something the devil has created to make life
miserable for programmers!

On Wed, Feb 22, 2017 at 4:07 PM, Raul A Jager W <raul@xxxxxxxxxx> wrote:

You need to show only or also read?

Will blank mean null and zero the value zero? To display you can use
%editc() to move to a char field if not null, and clear the field if

null.

You need to validate only if you need to read the field.


On 02/21/2017 06:17 PM, Bob Cagle wrote:

Is there a way to display a null value on a display file? I have a user
requesting that a 2-digit numeric field show either blanks or zero as

well

as 1 - 99, emulating Excel-like behavior.

The only solution I can think of is to convert it to a character field
and validate for numeric or blank. Suggestions?

Thanks

Bob Cagle
IT Manager
Lynk



-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
-- Verificado por Anti-Virus Corporativo Symantec --

--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD



--
Regards,
Henrik Rützou

http://powerEXT.com <http://powerext.com/>
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD



-- Este e-mail fue enviado desde el Mail Server del diario ABC Color --
-- Verificado por Anti-Virus Corporativo Symantec --
--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.