You need to sign in to do that
Don't have an account?
Brian Cherry FWI
Compile Error: line breaks not allowed in string literals at line 14 column -1
Here is my code:
Any thoughts why I'm getting this error?
public expenseController(ApexPages.StandardController controller) { this.proj = (Expense_Report__c) controller.getSubject(); this.delivers = '[SELECT d.Name, d.Billable__c, d.Comments__c, d.Travel_type__c, d.Purchase_type__c, d.Expense_Report__c, d.Id, d.Purchase_Date__c, d.Quantity__c, d.Sales_Tax__c, d.Shipping__c, d.total__c, d.type__c, d.unit_price__c, d.Description__c,d.Price_Override__c,d.Override_Price__c'+ 'FROM Expense_Line_Items__c d' + 'WHERE d.Expense_Report__c = : proj.id' + 'Order by' + 'sortOrder' + 'DESC' + ']'; }
Any thoughts why I'm getting this error?
Regards,
Mahesh
Compile Error: Illegal assignment from String to List<Expense_Line_Items__c> at line 16 column 5
What I am trying to do is have a variable string determine the sort order. I can't do it by simply Order by :SortVariable.
I think you need to use database.query to execute the query string. This will then return you a list of sobjects.
For more information on using Dynamic SOQL see: https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dynamic_soql.htm
Hope that helps,
Richard Jimenez
I want to bea ble to use the string SortOrder to do the sorting as I plan to update the string through VS page
Regards,
Mahesh
Error: Error Error: Compile Error: Illegal assignment from Expense_Report__c to String at line 11 column 12
I really appreciate you looking into this. I think it has to do with this.delivers being a list versus a string.
At line 11 your mistake is whatever you put in b/w '' single quotes is considered as string & delivers is an Array.
Plese find the below modified code (Also added comments to understand it easily.)
Please do let me know if it helps you.
Regards,
Mahesh