Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Schema Boolean Default value

Avatar

Avatar
Validate 1
Level 1
andreac50638695
Level 1

Likes

2 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 1
View profile

Avatar
Validate 1
Level 1
andreac50638695
Level 1

Likes

2 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 1
View profile
andreac50638695
Level 1

26-04-2017

Hi All,

I'm trying to create a Boolean field into my custom schema with default value set as "true".

I tried with the following statement:

<attribute default="true" label="Export to FOX" name="foxExportFlgg" type="boolean"/>

Unfortunately the default value is always set as false.

This is the generated SQL code:

ALTER TABLE NmsDelivery ADD iFoxExportFlgg SMALLINT;

UPDATE NmsDelivery SET iFoxExportFlgg = 0;
ALTER TABLE NmsDelivery ALTER COLUMN iFoxExportFlgg SET Default 0;
ALTER TABLE NmsDelivery ALTER COLUMN iFoxExportFlgg SET NOT NULL;

 

Could you please help me?

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile

Avatar
Validate 1
Employee
Vapsy
Employee

Likes

369 likes

Total Posts

726 posts

Correct Reply

342 solutions
Top badges earned
Validate 1
Boost 50
Boost 5
Boost 3
Boost 250
View profile
Vapsy
Employee

26-04-2017

Hi,

Please use the sqlDefault attribute and set it to value of choice.

Boolean field at SQL level transforms to an integer of 8 bit and can hold value as 0 or 1. 0 corresponds to False and 1 corresponds to True.

If you use the code like this it will work as required

<attribute default="true" label="Export to FOX" name="foxExportFlgg" type="boolean" sqlDefault="1" />

Hope this helps.

Regards,

Vipul

Answers (2)

Answers (2)

Avatar

Avatar
Validate 1
Level 1
andreac50638695
Level 1

Likes

2 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 1
View profile

Avatar
Validate 1
Level 1
andreac50638695
Level 1

Likes

2 likes

Total Posts

11 posts

Correct Reply

0 solutions
Top badges earned
Validate 1
Give Back
Ignite 1
Boost 1
View profile
andreac50638695
Level 1

26-04-2017

Thank you very much for your support guys!

It is working.

Best,

Andrea

Avatar

Avatar
Boost 50
Employee
Adhiyan
Employee

Likes

239 likes

Total Posts

342 posts

Correct Reply

124 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile

Avatar
Boost 50
Employee
Adhiyan
Employee

Likes

239 likes

Total Posts

342 posts

Correct Reply

124 solutions
Top badges earned
Boost 50
Boost 5
Boost 3
Boost 25
Boost 100
View profile
Adhiyan
Employee

26-04-2017

Hello Andrea,

I believe the SQL script is generated when you try to update the DB structure . If this is true , the script is editable. 

Can you change the SET DEFAULT to 1 from 0 and see if the default changes to True.