0

I have to add some fields values in a string. The fields are Id, date, string and integer. The point is I can do this in that way:

String s;
s= record.Id + record.Name + record.Date__c  + record.Code__c;

I've tested that and it's working but when I try to change the order of the fields I get this error "Arithmetic expressions must use numeric arguments".

0

You need to make sure there's way the compiler thinks you're trying to do math (e.g. two numbers next to each other). A simple fix is to place an empty string between each value (or whatever you want to use for separation between values):

String s = record.Id + '' + record.Name + '' + record.Date__c + '' + record.Code__c;
1
  • Perfect, thanks – user85807 Jul 28 '20 at 21:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.