You need to sign in to do that
Don't have an account?
The Walrus
system.debug display of a single field
I have the following query and debug statements:
Invoice_Balance__c[] b = [SELECT Invoice_Balance_Date__c, Invoice_Balance_Amount__c, Invoice__r.Name FROM Invoice_Balance__c WHERE Invoice__r.Name LIKE :xxx ORDER BY Invoice_Balance_Date__c DESC NULLS LAST LIMIT 1]; // System.debug('b: '+b); System.debug('b: '+Invoice_Balance__c.Invoice_Balance_Amount__c[b]);
The first system.debug statement works, but the second generates this error:
Error: Compile Error: Expression must be a list type: Schema.SObjectField at line 18 column 20
What do I need to change in the second statement? Thanks
Am not sure what exactly you are trying to do with this
But if you were trying to fetch the value from particular index then you can do something like this
Also complete code to debug all values is below :
Thanks
Ankit Arora
Blog | Facebook | Blog Page
All Answers
Try this:
Hope this helps.
Thanks,
Devendra
Am not sure what exactly you are trying to do with this
But if you were trying to fetch the value from particular index then you can do something like this
Also complete code to debug all values is below :
Thanks
Ankit Arora
Blog | Facebook | Blog Page
Wow. Very cool. Thanks
What I was trying to do was exactly what your code snippet does - present the result of my Select statement, but only the one field - the Invoice_Balance_Amount__c. So basically, even though I limited my selection to one, I was not placing the result in a list.
Thanks again, this is very helpful.
Am happy that it helped you.
Thanks
Ankit Arora
Blog | Facebook | Blog Page