Is There A Way To Turn Off A Scripted Field If There Is No Value Entered Into The Field Used For The Calculation? S’abonner

0
Avatar
Legacy Poster

I have a label that I need to be able to print values for weights in both pounds and kilograms.  I want the label to automatically calculate the information for the value that is not given. 

i.e. If you put in pounds kg is calculated or if you put in kg then pounds are calculated.

 

I have a label built with entered value and script calculated value entered directly or top of one another, with a box each for weight in LBS and weight in KG on the Data Entry Form.  I would like if the Pounds box is left empty then the lbs be calculated and filled in on the label.

  This part is currently working, however whichever box is left empty LBS or KG, I then get a script  error for the calculation associated with that box.

 

Alternately, if it would could be done I would like to add a drop down list to the data entry form that would allow users to select LBS or KG.  Then the user would put info in the Weight box of that type.  The typed info then would fill the appropriate field on the label and the opposing field would be calculated and filled. 

 

Thank you in advance for any help.

4 commentaires

0
Avatar
Michael Toupin (mtoupin
Actions pour les commentaires Permalien

What's the script error that you're seeing?  

 

Make sure that you're doing some sort of null validation (so something like 'if value <> "" then').

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Do I put the 'if value <> "" then' in my calculated value field or as a script in the data entry form?

 

Currently I have no if then statement in my script because I keep getting a syntax error when I try to enter it.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Currently with no if then statement in my script for my calculated weight I get  " BarTender: Error Message # 3904 "  It says it is a spript type mismatch.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien


  1. If "EnternetKG1" >0 Then


    Formatnumber(Format.Objects("EnternetKG1").Value * 2.20462,1)


    Else


    Print ''


    End If

This is my If then statement, I want my script to do the calculation if a number is present otherwise leave the field blank,  I keep getting a syntax error that reads

<Line 1: Value = If "EnternetKG1" >0 Then: Syntax error>

Vous devez vous connecter pour laisser un commentaire.