This seems like it should be simple, but...
I'd like the value from Part_Number & PNIC to show up in another field like "Part Number-PNIC"
All of thse fields are single line text fields. These are all in the same workspace.
Also is there any "real" documenation on using the computed field fomula...like the syntax, etc.???
Thanks,
JD
Solved! Go to Solution.
Solved by dvirh. Go to Solution.
Yes, you can certainly do that! You will need a Computed Field for that with the following formula (adjust it to add space paddings or other symbols as needed - simply use || to add another segment to the text, and quotes to add fixed text):
PART_NUMBER || PNIC
another example:
'Part Number : ' || PART_NUMBER || ' and pnic: ' || PNIC
Hi,
If the fields are picklists, how to obtain the value and not the unique ID?
For example,
I have 1 picklist (ID: PROJECT) with the following values: "titi", "tutu", "toto"
I have a second picklist (ID: ORIGINATOR) with the following values: "qw", "er"
I have created a third field which concatenate the field 1 with the field 2. I have defined it as a computed field with the following code:
PROJECT || ' - ' || ORIGINATOR
If I create an object with field 1 = "tutu" and field 2 = "er".
Instead of returning: tutu - er
It returns: 3 - 2
I suppose that the numbers are the unique ID of the values in the different picklists. How is it possible to return the value?
Thanks,
Sylvain
The internal ID is used for picklists with fixed values.
So, you will need to create logic to interpret the values.
Or instead of using a computer field,use a read only single line text field,and populate this based on the values of other fields.
Eg create a script, set it as an on create and on edit script for your workspac.
Then use a piece of trivial logic like this:
item.F3 = item.PART_NUM + '-' + item.ANOTHER_FIELD;
This will handle picklists automatically.
The above script is trivial JavaScript.
BTW your original question about computed fields,the language there is.SQL. If you Google for PostGres SQL there are plenty of examples.
If you want to extract a value from a picklist you need to turn the index integer into a string, either with a Case statement or perhaps using a split function. But you will need to adjust your formula whenever the picklist definition changes.
Hence the JavaScript example might be easier than a computed field whenever you have a picklist as one of the fields.
You also have more flexibility with JavaScript. For example if your second field had an empty value and you wanted to skip the delimiter when so, this much easier and supportable in JavaScript .
Thank you Tony and Philip. I will create an example using the script. It is easy to do and to maintain.