Page 1 of 1

Add Boolean Field with Default True to LANSA File

Posted: Tue Jun 02, 2020 3:34 am
by jyoung
I have a LANSA built File that I am trying to add a Boolean field to with the default value of TRUE so that EVERY EXISTING RECORD in the File will be set to True.
IsEnabled.PNG
IsEnabled.PNG (12.51 KiB) Viewed 36666 times
File.PNG
File.PNG (33 KiB) Viewed 36666 times
However when I compile the Table with Rebuild / Drop and Load the Field is always (0) False.
Table.PNG
Table.PNG (7.43 KiB) Viewed 36666 times
How do I make the IsEnabled Field default to True (1)?

I tried using 1 for the default value, but it changes to +1 and still default to 0.

Thanks,
Joe

Re: Add Boolean Field with Default True to LANSA File

Posted: Wed Jun 03, 2020 1:34 am
by atostaine
I would bet that LANSA uses SQL or CPYF under the covers and does not go through the OAM. That means that you would have to set your own default for existing records.

Art

Re: Add Boolean Field with Default True to LANSA File

Posted: Wed Jun 03, 2020 2:59 am
by jyoung
That means setting the ASQN attribute which also means having to check for NULL or True for EVERY QUERY.

Ugh.

Was hoping to not have to do that, but it seems like the only way.

Thanks Art.

Re: Add Boolean Field with Default True to LANSA File

Posted: Wed Jun 03, 2020 3:07 am
by atostaine
After you recreate the file why can't you fix the records? Are you doing this as part of a production job or development?

Can't you run an update file set isAdmin = true after?

Re: Add Boolean Field with Default True to LANSA File

Posted: Wed Jun 03, 2020 4:56 am
by jyoung
I can and will probably do that instead of trying to do some dynamic where clause.
The issue is that this is in production and we have automated deployments so we will kick this off at night when no one is on the system. At which point I will have to log in from home and run the update script.

Its more steps that would be completely unnecessary if it honored the default value like it should.

Re: Add Boolean Field with Default True to LANSA File

Posted: Wed Jun 03, 2020 2:52 pm
by soa
To me this is quite clearly a defect and should be reported as such.