Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
767 views
in Technique[技术] by (71.8m points)

botframework - Cannot set property with previously defined property in botbnt framework composer

I am working on a bot build with Microsoft bot framework composer

I have an HTTP request that works and returns an array of programs

Currently, I have a "0" hard set and that works ${dialog.programlistlite.api_response.content.programs[0].name}

what i am trying to do is take property called dialog.resultnumber which is set to 0 and replace static "0" above with property called dialog.resultsnumber

I tried:

${dialog.programlistlite.api_response.content.programs[${dialog.resultsnumber}].name}
${dialog.programlistlite.api_response.content.programs[(dialog.resultsnumber)].name}
${dialog.programlistlite.api_response.content.programs[dialog.resultsnumber].name}
${dialog.programlistlite.api_response.content.programs[getproperty(dialog.resultsnumber)].name}
${dialog.programlistlite.api_response.content.programs[dialog.resultsnumber()].name}
${dialog.programlistlite.api_response.content.programs[${dialog.resultsnumber()}].name} 

I cannot find the syntax to use an already defined property to build a new property

question from:https://stackoverflow.com/questions/65907216/cannot-set-property-with-previously-defined-property-in-botbnt-framework-compose

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

what i am trying to do is take property called dialog.resultnumber which is set to 0 and replace static "0" above with property called dialog.resultsnumber I tried:

Are you sure that dialog.resultsnumber is an int?

If you set it in a single set property action, make sure you set it as an int, the default is a string.

How to set property to integer type

This below should be the one. It worked for me (with the above caveat): ${dialog.programlistlite.api_response.content.programs[dialog.resultsnumber].name}

You can also use the isInteger() type checking function to confirm if something is an int, or try and force/convert/coerce using int() if needed as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...