function readOnly(count){ }
Don't have an account?
Search for an answer or ask a question of the zone or Customer Support.
You need to sign in to do that
Sign in to start searching questions
Signup for a Developer Edition
Sign in to start a discussion
hi,
can anybody help me in this topic.
The value in a picklist is simply the value of that datatype. If you have a picklist of type string, then simply compare that string value to another.
can you please help me through a code written in apex class
Simply comparing the currently selected values in two picklists is very straightforward:
if (<yourObject__c>.pickListOneFieldName__c != <yourObject__c>.pickListTwoFieldName__c) ...
Now, if you are asking how to compare *all* possible values that can be held by the two picklists, then you need to access the metadata API:
Schema.DescribeFieldResult fieldResult1 = <yourObject__c>.pickListOneFieldName__c.getDescribe();
List<Schema.PicklistEntry> ple1 = fieldResult1.getPicklistValues();
Schema.DescribeFieldResult fieldResult2 = <yourObject__c>.pickListTwoFieldName__c.getDescribe();
List<Schema.PicklistEntry> ple2 = fieldResult2.getPicklistValues();
// Loop over the Lists and compare as desired
for (Schema.PicklistEntry f : ple1) {
for (Schema.PicklistEntry f : ple2) {
<<compare>>
}
The value in a picklist is simply the value of that datatype. If you have a picklist of type string, then simply compare that string value to another.
can you please help me through a code written in apex class
Simply comparing the currently selected values in two picklists is very straightforward:
if (<yourObject__c>.pickListOneFieldName__c != <yourObject__c>.pickListTwoFieldName__c) ...
Now, if you are asking how to compare *all* possible values that can be held by the two picklists, then you need to access the metadata API:
Schema.DescribeFieldResult fieldResult1 = <yourObject__c>.pickListOneFieldName__c.getDescribe();
List<Schema.PicklistEntry> ple1 = fieldResult1.getPicklistValues();
Schema.DescribeFieldResult fieldResult2 = <yourObject__c>.pickListTwoFieldName__c.getDescribe();
List<Schema.PicklistEntry> ple2 = fieldResult2.getPicklistValues();
// Loop over the Lists and compare as desired
for (Schema.PicklistEntry f : ple1) {
for (Schema.PicklistEntry f : ple2) {
<<compare>>
}
}