Automated Scripted Factors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Is it possible to take yes/no variable fields or checkbox variable fields and turn them into numbers for scripted factors? If so, anyone have a sample script to try out?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @hneeley
You can do it.
Sample code:
var isApproved = current.variables.chkbox_variable.toString(); // Checkbox usually true/false
var chkAccess = current.variables.yesNo_variable.toString(); // Yes/No usually 'yes' or 'no'
//Convert to Numbers (1 for true/yes, 0 for false/no)
var checkboxValue = (isApproved === 'true' || isApproved === '1') ? 1 : 0;
var yesNoValue = (chkAccess === 'yes' || chkAccess === 'true') ? 1 : 0;
Using last 2 variable, you can calculate scripted factor or storing into Numeric field.
