You need to sign in to do that
Don't have an account?
PavanReddy
Illegal assignment error?
Hi guys
How to handle this type of error?
Error: UploadDoc Compile Error: Illegal assignment from String to Decimal at line 47 column 5
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
Hi guys
How to handle this type of error?
Error: UploadDoc Compile Error: Illegal assignment from String to Decimal at line 47 column 5
you are assinging the wrong type to another type.. if you are assigining a string to decimal then you need to do some thing like this
String temp = '12.4567'; Decimal myDecimal = decimal.valueOf(temp);
Thx a lot kiran for ur reply
Below is my sample code. when i was trying to access these fields i am getting illegal statement error so i commented.
while declaring the fileds i have declared for this datatype as 'Number '.
Plz have a look below code once
plz do the needfull
thx in advance...
public Pagereference ReadFile()
{
nameFile=contentFile.toString();
filelines = nameFile.split('\n');
accstoupload = new List<property__c>();
for (Integer i=1;i<filelines.size();i++)
{
String[] inputvalues = new String[]{};
inputvalues = filelines[i].split(',');
property__c pt = new property__c();
//pt.property_value__c= inputvalues[1];
//pt.property_zip__c= inputvalues[2];
//pt.land_value__c= inputvalues[3];
}
hard to say like this with out code...
Plz find below code kiran..
thx in advance
after u getting the list of values from the split you need to assing the values from list to the some object fileds by respecting their type....so when ever u are assigining a value please take care about the target field type ....
//pt.property_number__c = integer.valueof(your string value); like this all should satisfy also you should check for whether the list is having values or not.....using list methods....
thx for ur reply kiran..could u please tel me ur gmail id?
i am getting
" Error: Compile Error: Illegal assignment from String to Decimal "
Why this is so?
To avoid this error i am using "decimal.valueof(csvRecordData[1]);"
it gives the reverse error " Error: Compile Error: Illegal assignment from Decimal to String ".
public void importCSVFile(){
try{
csvAsString = csvFileBody.toString();
csvFileLines = csvAsString.split('\n');
for(Integer i=1;i<csvFileLines.size();i++){
Distributor_Prior_Sales__c prisale = new Distributor_Prior_Sales__c() ;
string[] csvRecordData = csvFileLines[i].split(',');
prisale.SMS_Year__c= csvRecordData[0] ;
prisale.SMS_sales_amount__c= csvRecordData[1];
prisale.Exhibit_A_Customer__c= csvRecordData[2];
prisale.Calculation_Type__c= csvRecordData[3];
accon.add(prisale);
}
//insert acclist;
}
catch (Exception e)
{
ApexPages.Message errorMessage = new ApexPages.Message(ApexPages.severity.ERROR,'An error has occured while importing data Please make sure input csv file is correct');
ApexPages.addMessage(errorMessage);
}
}
I have a error in below trigger code.
*********************************************************
trigger AccountNameUpdate on Booking_Link__c (before insert, before update) {
List<Account> accountList = new List<Account>();
Decimal CustomNumber;
for(Booking_Link__c bl : Trigger.new)
{
6th CustomNumber = bl.Customer_Number__c;
}
8th accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__pc =:CustomNumber ];
for(Booking_Link__c bl : Trigger.new)
{
for(Account a : accountList)
{
if(bl.Customer_Number__c == a.Customer_Number__pc)
{
bl.Account__c = a.Id;
bl.OwnerId = a.OwnerId;
}
}
}
}
*****************************************************************************
Line 6: CustomNumber = bl.Customer_Number__c;
Line 8: accountList = [Select Id, OwnerId, Customer_Number__pc from Account where Customer_Number__c =:CustomNumber ];
In Line 8 i have changed the bold one from Customer_Number__c to Customer_Number__pc.
why because we have the Customer Number field API as above because we are using PersonAccount.
Please help me from these errors.
Errors:
Line 6: Illegal assignment from String to Decimal
Line 8:
Customer_Number__pc from Account where Customer_Number__c =:CustomNumber
^
ERROR at Row:1:Column:60
No such column 'Customer_Number__c' on entity 'Account'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names.
Guys, Please help me out from this.
Thanks and Regards,
Azar Khasim.