AnsweredAssumed Answered

Passing default value from input as parameter into PW WS returns no value

Question asked by dnnsrnhrdt on Jan 29, 2019
Latest reply on Feb 7, 2019 by Bjorn.Sundling1

Hi @ll,

 

I've build a easy PS WS to do some calculations, but I'm unable to pass the default value from "Input 1" into my PS WS as parameter. The WS recognizes the input as empty string. Details below.

 

Input 1, normal text field with default value "1"

I hope i interpret "what is the value for this paramater" right

 

Output with PS WS and two input parameters

PS WS 1

function Calculate-ServicePrice
{
   # Add the input parameters as a comma separated list within the param statement.
   param(
    $amount,
    [Double]$servicePrice
    )
 $amount
}

Returns "No Value"

 

PS WS 2, including ::IsNullOrWhiteSpace

function Calculate-ServicePrice
{
   # Add the input parameters as a comma separated list within the param statement.
   param(
    $amount,
    [Double]$servicePrice
    )
 
   If([string]::IsNullOrWhiteSpace($amount))
    {
       $amount = "NULL VALUE"
       $amount
    }
   Else
   {
       $amount
 }
}

Returns "NULL VALUE"

 

 

Question: Any idea, why I'm not able to pass the default value as parameter into my PS WS.

 

Thanks and Best,

Dennis

Outcomes