Andrew Clark
Posts: 0
Joined: Sun Jan 05, 2014 1:26 pm

Hiding a NaN response in label follwing calculation

I realise this is a simple question but I cant seem to work out a way to deal with it even having read thru this conversation.

I have have grid with several calculated responses in labels. Because of the nature of calculation I will get NaN response in one or more labels in the grid - this is ok and quite ok. The calculations are done via j query script when a button is clicked.

What I would like to do is hide the NaN responses that is displayed in the label.

I have tried several way of using hide command identified in conversations.

I suspect this is simple bit of script, unfortunately I can't seem to do it. Can some one point me in right direction or provide an example.

Secondly where would the script be placed and invoked. Or would it be better just to do it via CSS.

Thanks in advance

Andrew

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Hiding a NaN response in label follwing calculation

Hello,

Please clarify, do you use a mapping for that? If so - please use a condition 'if' here, e. g. preif(isNaN (myValue) {
element.hide();
}/pre

Andrew Clark
Posts: 0
Joined: Sun Jan 05, 2014 1:26 pm

Hiding a NaN response in label follwing calculation

Thanks for this I will try. I had not used the 'if' condition, though I did think that what was required. I will try diffent ways to incorporate the condition

The label field is poplulated from a calculation. So it not mapped. This is an example of calculation I am using. This is invoked by clicking on a button.

Code: Select all

 var Price_Weekly = Number (Apperyio("Price_Weekly").text()); 
 var dollars = Number (Apperyio("dollars").val()); 

 var cal_weekly = dollars/Price_Weekly; 

 Apperyio('cal_weekly').text(cal_weekly.toFixed(1) + ' - Weeks of Service' ) ; 

Sorry about slow response, as I am diffrent time zone.

Thanks for your response

Andrew

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Hiding a NaN response in label follwing calculation

In that case you have to use JS like:
preif (isNaN(Price_Weekly)||isNaN(dollars)){
Apperyio('cal_weekly').hide();
}/pre

Andrew Clark
Posts: 0
Joined: Sun Jan 05, 2014 1:26 pm

Hiding a NaN response in label follwing calculation

thanks will try it now.

Andrew

Andrew Clark
Posts: 0
Joined: Sun Jan 05, 2014 1:26 pm

Hiding a NaN response in label follwing calculation

I forgot to ask where this script goes. Sorry about my lack of knowledge

Andrew

Andrew Clark
Posts: 0
Joined: Sun Jan 05, 2014 1:26 pm

Hiding a NaN response in label follwing calculation

No need to reply I worked it out, place it in calculation script.

Ance agian thanks

Return to “Issues”