cancel
Showing results for 
Search instead for 
Did you mean: 

reset bigdecimal field

Former Member
0 Kudos

Hi,

I defined in the context a field with type bigdecimal.

At the begining the field is null but if i enter something (go to the server),and after that i remove what i entered..now the field instead of having a null value has 0.

Florin

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member189631
Active Contributor
0 Kudos

Florin,

*By default a varible value is null when its get declared.

*You can reassign as <b>null</b> for that variable.

Regards,

Ram.

Former Member
0 Kudos

Hi Florin,

Once the object is initialized, by default it takes 0. So if you dont want any value to be displayed/stored, reinitialize to null.

Thanks.

Best Regards,

Shiva

Former Member
0 Kudos

I can't make the diference when the users put 0 or blanks in order to reinitialize.

Florin

abhijeet_mukkawar
Active Contributor
0 Kudos

hi,

it shows null because it is not initialised, yu can explicitly initialise it in wdinit() method, like

wdContext.currentContextElement().setBigd(new BigDecimal(0));

then it will always show 0

regards

Former Member
0 Kudos

Hi

For me 0 and null ar 2 dififerent values. I can't catch if the user removed his entry after he already puted something because i always get 0.

Florin

abhijeet_mukkawar
Active Contributor
0 Kudos

could you please let me know when do you want to use 0 and when you want to use null

you can take use of boolean values lets say flag, which will be set true if user fills something and then deletes it , just like what we have in wdmodifyView() , "Firsttime".

Same way you can set that flag to true in Modify(), so when it does server round trip it will be set to true and u can then track the change done by user

hope it helps

regards

Message was edited by:

Abhijeet

Former Member
0 Kudos

But how you can check if user removed current value (set it to blank) or entered 0. Even with a flag solution you cant check it because in context in both situation you have 0 value

abhijeet_mukkawar
Active Contributor
0 Kudos

okay, so i understand there are two scenario,

1) when user explicitly set it to 0 and,

2) when he removes corrent value and let it be blank(in this case 0 gets stored after server round trip right?).

1) when user explicitly set it to 0 : In this case when application is about to do server round trip the value in input field is 0, ie value is 0 before it returns from server round trip, so you can directly check the value

2)when he removes corrent value and let it be blank : here there is nothing before server round trip so you can directly check this for blank, or if it is not 0 or any other value, coz in this scenario 0 gets stored after server round trip

hope it helps

regards

Former Member
0 Kudos

Hai,

Youcan check like this

if(wdContext.currentContextElement.getBigDec==null ||wdContext.currentContextElement.getBigDec.toString().trim().equals("")||wdContext.currentContextElement.getBigDec==0){

// your code here
}

regards,

Naga