Discussions
- General Development
- Schema Development
- Apex Code Development
- Visualforce Development
- Formulas & Validation Rules
- Security
- Mobile
- Force.com Sites & Site.com
- Chatter Development
- Java Development
- .NET Development
- Perl, PHP, Python & Ruby
- Desktop Integration
- APIs and Integrations
- Visual Workflow
- Apple, Mac and OS X
- VB and Office Development
- AppExchange Directory & Packaging
- Salesforce Labs & Open Source Projects
- Other Salesforce Applications
- Jobs Board
- Force.com Discussion Boards
- :
- Developer Boards for Force.com and Database.com
- :
- Apex Code Development
- :
- Use an operator inside a Ternary Opeartor?
turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
0
Use an operator inside a Ternary Opeartor?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-19-2013 10:23 AM
I am trying to increment a field based on if/else logic. I'm just starting to get the hang of the ternary operator. So, I wrote the following, but it won't compile. Does anybody know if it's possible to do this, or does it have to go in an if else statement?
conCD.CourseRoleCount__c = source == 'Course' ? +=1 : 0;
0
Re: Use an operator inside a Ternary Opeartor?
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-19-2013 10:28 AM
I just figured it out:
conCD.CourseRoleCount__c += source == 'Course' ? 1 : 0;

