determine if field is to be calculated base on position and charge code
ok, so I'm trying to make a field be document level script based on whether it's the first/last field in a range of fields with a value. So "Field1" has charge code 8008 and "FieldA-G" has a $40. Then the FieldA and FieldG values should be calculated at 75% and the rest stay the same.
Could possibly work like this in powershell. But i need it in JS
$global:arrFieldsWithValues = @()
function TrackField($field) {
if ($field > 0){
$global:arrFieldsWithValues += $field
}
}
if ($global:arrFieldsWithValues.Count -eq 1) {
$Total = $global:arrFieldsWithValues[0] * .75
}
if ($global:arrFieldsWithValues.Count -eq 2) {
$Total = $global:arrFieldsWithValues[0] * .75
$Total += $global:arrFieldsWithValues[1] * .75
}
if ($global:arrFieldsWithValues.Count -ge 3)
{
$Total = $global:arrFieldsWithValues[0] * .75
$Total += $global:arrFieldsWithValues[$global:arrFieldsWithValues.Count - 1] * .75
for($i = 1; i$ < ($global:arrFieldsWithValues.Count - 1); $i++)
{
$Total += $global:arrFieldsWithValues[$i]
}
}
