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

Define format of a varible

Avatar

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
aka44356106
Level 2

28-09-2019

it is possible to define num format for a variable

for example    var a1 = NumericField1.rawvalue  & var a2 = NumericField1.rawvalue             var total = a1 + a2 (num format, z,zz,zz,z9.99)

     this.rawValue = " My Score" + total;

i tried many ways but always failed.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

29-09-2019

You can use util.printf

e.g.

util.printf('%,0.2f', 12345.67)

will give you

12,345.67

Answers (6)

Answers (6)

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

30-09-2019

I see what you mean, I didn't think it worked like that.

Seems text{'name 'XXXXXXXXXXXXXXX' '} would work, that is adding a space at the end.

Just make sure there are more 'X's than your longest value.

Avatar

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
aka44356106
Level 2

01-10-2019

working fine

Thanks a lot

Avatar

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
aka44356106
Level 2

29-09-2019

thank you very much

Exactly i search for it.

Avatar

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct Reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile

Avatar
Coach
MVP
radzmar
MVP

Likes

397 likes

Total Posts

2,687 posts

Correct Reply

492 solutions
Top badges earned
Coach
Ignite 3
Ignite 1
Validate 1
Give Back 50
View profile
radzmar
MVP

29-09-2019

You could use a text field instead of a numeric field and create the desired string by joining parts.

; FormCalc

$ = Concat("My score ", Sum(NumericField1, NumericField2))

//JavaScript

this.rawValue = "My score ".concat((NumericField1.rawValue + NumericField2.rawValue));

Avatar

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile

Avatar
Validate 10
Level 2
aka44356106
Level 2

Likes

10 likes

Total Posts

56 posts

Correct Reply

0 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 10
View profile
aka44356106
Level 2

29-09-2019

There are any other way to define format under varible script

Avatar

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile

Avatar
Establish
MVP
_Bruce_Robertson
MVP

Likes

271 likes

Total Posts

1,782 posts

Correct Reply

372 solutions
Top badges earned
Establish
Give Back 25
Give Back 10
Give Back 5
Give Back 3
View profile
_Bruce_Robertson
MVP

28-09-2019

I assume the code 'this.rawValue = "My Score " + total' is in a calculate event of a field?  You could try adding a display pattern to that field of

num{'My score ' z,zzz,zz9.zz}

Then the calculate event code would just be 'this.rawValue = total'