Highlighted
Acclaimed Contributor.
Acclaimed Contributor.
305 views

Fill in the field value on form according to the value condition of the other two fields

We need fill value for some field (text value in read only)

There is a list of values for a text tield (let the field name be class) on the form.

What value to substitute in this field depends on the value of the other two fields (the name for them is type and cost).

For each value in the type field, there are value ranges for the cost field that give the value in the class field.

List of type value stored in personal table. All 3 fields will stored in one table (device)

Example to understand the question:

 

For type="type 1" and cost in range 0-10 class = "class1.1"

For type="type 1" and cost in range 11-100 class = "class1.2"

For type="type 1" and cost in range 101-1000 class = "class1.3"

For type="type 2" and cost in range 0-10 class = "class2.1"

For type="type 1" and cost in range 11-100 class = "class2.2"

For type="type 1" and cost in range 101-1000 class = "class2.3"

The range may be different for each type

0 Likes
3 Replies
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Fill in the field value on form according to the value condition of the other two fields

As I see the solution to this may be next:

1) create new table (classlist) where set next columns: type, class,  first digit of diapason(FDD), last digit of diapason (LDD)

2) Use triggers or FormatControl - for Add/Update (table device)

3) use script to get value from class field of table (classlist) by condition classlist.type=device.type and "cost" > FDD and "cost" < LDD

 

maybe there is a better solution ?

0 Likes
Highlighted
Knowledge Partner
Knowledge Partner

Re: Fill in the field value on form according to the value condition of the other two fields

Your solution is good, you may just need to add your script to DO. If users can alter the source fields, you may want to set an event to update the class value.

Another option would be have a generic table, its useful if you have more situations like these one. The table could have as many fields as you want but the mandatory is key and value, the values would be something like:
key: xxxtype 1;0 / value:class1.1
key: xxxtype 1;1 / value:class1.1
The benefit of this generic table is that you can use the same table for other situations.. the problem is that you may have more lines... it's up to you choose 🙂
Regards,
Breno Abreu

If you feel this was helpful please click the KUDOS! thumb below!
Highlighted
Acclaimed Contributor.
Acclaimed Contributor.

Re: Fill in the field value on form according to the value condition of the other two fields

Thnx for answer.

- Yes i made in this my new table the id field and set autonumbering for this field in number table.

- In DO you mean in PreJavaScript ?

- How about link from device to this new table (i mean without JS) ?

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.