Skip to main content
Inspiring
February 9, 2019
Question

short 10 fields value number min to max

  • February 9, 2019
  • 5 replies
  • 602 views

hello team,

i have 10 text fields

Text1

Text2

Text3

.

.

.

.

.

Text10

i want a solution how to short numbers min to max on this fields

e.g.

Text1 value = 1

Text2 value = 3

Text3 value = 2

2

7

6

5

Text8 value = 9

Text9 value = 10

Text10 value = 8

and i want system check the fields and short the number

1

2

3

4

5

6

7

8

9

10

any help?

This topic has been closed for replies.

5 replies

hackertomAuthor
Inspiring
February 12, 2019

i try this code to read text values :

var fieldst = ["Text1","Text2","Text3","Text4","Text5","Text6","Text7","Text8","Text9","Text10"];

for (var i in fieldst) {

    var f = this.getField(fieldst);

    if (f.valueAsString=="1||2||3||4||5||6||7||8||9||10")

{

var points = [,];

points.sort(function(a, b){return a-b});

}

}

now i want some help how to add this value fields on table when this value = number ....

hackertomAuthor
Inspiring
February 11, 2019

i collect all the values, and put them in array, array short the values like this:

var points = [40, 100, 1, 5, 25, 10, 20, 38, 25, 12];

points.sort(function(a, b){return a-b});

now how to put the minimum value on Text1, and biggest on Text10? how to avoid values which are not numbers?

try67
Community Expert
Community Expert
February 11, 2019

Iterate over the array from start to end and apply each value to the corresponding field.

Just remember the array indices start from 0, not 1, so you need to add +1 to the array index number to get the correct index number for the fields.

hackertomAuthor
Inspiring
February 11, 2019

i need a example not a full code, and i think this forum is for help not for pay to solve the problems...

try67
Community Expert
Community Expert
February 11, 2019

Example of what, exactly?

hackertomAuthor
Inspiring
February 11, 2019

it is possible for any code example because i stuck...

Any fiend must check all other fields every time? if fields isn't a number but space or latter or something else how to avoid?

try67
Community Expert
Community Expert
February 11, 2019

You have enough information to write the code yourself, I believe. If you have specific questions we'll be happy to answer them, but if you want someone else to do your work for you, you'll probably need to pay them.

Bernd Alheit
Community Expert
Community Expert
February 9, 2019

You mean "sort" ?

hackertomAuthor
Inspiring
February 9, 2019

Yes sorry for this mistake sort I mean

Bernd Alheit
Community Expert
Community Expert
February 9, 2019

Read all values, sort the values, and save the values in the fields.