How to fetch data from DAI as value

Good day,

I am currently encountering a challenge with data retrieval from DAI, where the data is received as a string (e.g., “true,true”). This data needs to be passed to an API call in a non-string format (e.g., true,true). Given that the values can vary (e.g., “true,Approved,true”), directly using Boolean might not be feasible. I would appreciate any assistance in addressing this issue.

Thank you in advance.

Hey @bhaavan,

  • Can you share the sensetalk handler you are using?
  • “true,true” is this one parameter or two parameters in DAI.
  • Is it script or model based?
  • is is a model parameter or a parameter at a test case?
  • How do you enter the parameter string in DAI? Can you share a screenshot?
    In case you have one string “Karsten,Wenzke,Keysight”. you need to split if by comma in your handler
on MyHandler varA
Split VarA by comma
put varA // should be a list now
Put item 1 of VarA

Here an example handler that should work for two parameter of a model action

on MyHandler varA, VarB
put varA
put varB
end myHandler


Hello @Karsten ,
Thanks for your time .
PFB answers

  • “true,true” is this one parameter or two parameters in DAI.— one parameter
  • Is it script or model based? — Model Based
  • is is a model parameter or a parameter at a test case? ---- Test Case Parameter

Screen shot for parameters in DAI

Currently using handler
to handle FinalreqData

	Params FinalizationText
	put split(FinalizationText,",") into mylist
	put number of items in mylist into itemscount
	if itemscount = 0 then
		put () into Reqdata 	
		set icount =1
		repeat itemscount times
			insert item icount of mylist after Reqdata 
			add 1 to icount
		end Repeat
	end if		

end FinalreqData

Hey @bhaavan,

Not sure if your questions is solved or not.
Are you happy with your handler and it is working for you?

It takes the parameter string that by default is one text string as you have defined it.

I do not understand why you have the if statement.
Mylist is the same as reqdata. a list of n items

here is a handler that might do what you have in mind.

FinalreqData "true,abc,true" -- same as your DAI parameter

to FinalreqData FinalizationText
	split FinalizationText by comma -- this turns the text into a list
	put FinalizationText -- ["true","abc","true"]
	put number of items in FinalizationText into itemscount -- equals the number of items in the list
	put itemscount -- 3
	-- by default each variable is treated as text and sensetalk determines the type internally when needed. The user does not need to care about it. 
	put !"[[item 1 of FinalizationText]]" -- puts the value true without quotes. you will see just true on the output
end FinalreqData

for the merge “!” take a look at these resources:

Kindly ask you to explain what your desired goal is.
Hope the above is the answer to it. :slight_smile: