Combining several text variables into one

Hi from Germany.

Problem:
I have the text variables qpart_01, qpart_02 and qpart_03 in a project. These are given the following values by input fields: qpart_01 = abc, qpart_02 = def and qpart_03 = ghi. I then also have the text variable qpart_04 and this is to append the first three variables together so that qpart_04 then has the value qpart_04 = abcdefghi. I can output the text string abcdefghi in a text field (with %qpart_01%%qpart_02%%qpart_03%), but I need this text string as the value of a variable. Is this somehow possible?

ActivePresenter version: 9

OS: Windows 11

Notes:
I have also tried to read the text field with the content %qpart_01%%qpart_02%%qpart_03% (object name “Textfield_15”), but this does not work. I have executed the following JavaScript code:
var qpart_4 = prez.object(‘Textfield_15’).text();

Best regards Matthias

There are a few ways you may arrive at the same conclusion.
Here is how I would tackle it.

Not sure how you are assigning the values to the first three variables to begin with or how/when the concatenation is triggered so you would have to adapt this concept to fit your use case.

Code is placed on load.

concat.approj (288 KB)

Hope this helps.

Hi Greg,

Your answer has solved my problem - thank you very much! I only needed the last line of the script.

Here is some background to my question: I want to build a flashcard system for students to practice with and get AI feedback on their answers.

I want to send variable qpart_04 to a chatbot that provides an AI answer. This answer is based on teaching material that I have used to train the bot.

For example, qpart_04 could be the following question: “To what extent is the statement ‘excited motives’ the correct answer to the question: ‘What is motivation?’. Is there anything I should correct or improve in this answer? Also, give me a suggestion for an ideal answer.”

For qpart_01, I define the value => “To what extent is the statement ‘excited motives’ the correct answer to the question: ’

qpart_02 the students enter via an input field, e.g. => excited motives

For qpart_03 I define the value => ’ the correct answer to the question: 'What is motivation? Is there anything I should correct or improve in this answer? Also, give me a suggestion for an ideal answer.”

qpart_04 summarizes the three variables and sends them to the bot.

The bot’s answer should then be displayed on the ActivePresenter slide.

Best regards

Matthias

1 Like

Hi Matthias,

You can also use Adjust Variable actions to concatenate variables:

Regards

Thank you for the additional solution suggestion! Best regards, Matthias

1 Like