Question

Custom field number format

  • 22 September 2023
  • 7 replies
  • 88 views

Userlevel 1
Badge +8

Hello ,

 

I have created a custom field but I need it to be an integer>0 .

Does anyone have an idea how to achieve it.

 

Thank you in advance,

Hanane


7 replies

Userlevel 5
Badge +9

Hi @Hanane 

Set the data type to number format. 

I believe you will have to recreate as you cant change the data type after the custom field is created.

Userlevel 7
Badge +22

I agree with @EntNadeeL .

Set it during the creation to “Number”.

 

Userlevel 1
Badge +8

Hello ,

Thank you both for your responses , but my field is already a number (unformatted) .

Still I can enter decimal numbers and zeros in my field ( thing that I want to avoid ) .

 

 

 

Userlevel 2
Badge +9

Hello @Hanane 

is that a persistant or a read only ?

By your last screenshot you shared, I suppose it’s a persistant one.

In that case, I guess you won’t have any other solution than to create a custom event, in which you might correct the value of your CF

Userlevel 5
Badge +9

Hi @Hanane 

As @romsar mentioned here, create an event to _CFT table to validate the input of the field.

Code would be something simple similar to below.

DECLARE

BEGIN

IF (NEW:$field_value) < 0 or INSTR(to_char(2.0), '.', 1, 1)>0 THEN 

‘Error msg’

END 

Userlevel 2
Badge +9

the code woud be more like this :

BEGIN

  IF FLOOR(&NEW:COUNT)!=CEIL(&NEW:COUNT) THEN

      --display an error message

  END IF;

END;

Userlevel 1
Badge +8

Thank you all , but my managers try to avoid custom events , is there any way to do it beside the customization ? 

Reply