G-d willing
Hello,
Following my previous discussion, I would like to ask how do I define (and use) multiple parameters from within the --input-file
.
I understand that this is a JSON file.
I was told that when it is only 1 parameter, the file will only contain the text value between " char.
But how do I separate different arguments when I need to use more than one?
1 Like
Hi @cohen.avraham,
To have multiple parameters for the --input-file
you can create a custom data type which would correspond to the format and data you use for the input file.
For example:
module MyScript where
import Daml.Script
data ScriptSettings = ScriptSettings with
userParty : Party
userName : Text
userEmail : Text
deriving (Show, Eq)
runScript : ScriptSettings -> Script ()
runScript ScriptSettings{..} = do
debug $ "The username is " <> userName
return ()
Then the --input-file
JSON might look something like:
{
"userParty": "ledger-party-kj2340xfkjsdf0923j",
"userName": "Alice"
"userEmail": "alice@company.com"
}
3 Likes
Thank you very much, it works.
2 Likes