Summarise text fields into a single text field

In Filemaker I would create a calculation in a script to add the content of several text fields into a single text field. What would this be in Xojo? I could simple add the textfields together in the opening event of the Summary textfield, but maybe there is a more official way of doing this?

DesktopTextField.AddText “Text to add to the TextField”

An example is shared there…

You can add text to a TextField like @Emile_Schwarz described and you can add/combine strings like you would in some other languages:

TextFieldSummarized.Text = TextField1.Text + " " + TextField2.Text + ...

Like with JavaScript f.e.:
String s1 = "Text 1" + " " + "Text 2" + ...;

Any way that works without issues, is an official way :wink:

1 Like

Thanks, the Addtext method works great… however :slight_smile: When some text fields are not used, (skipped) I get an empty space between the lines of text in the summary text field. Is there a way to strip that out automatically?

So for example this is how it looks like in the summary text field when some of the other text fields not being used:
Screenshot 2022-09-22 at 16.04.44

The code I use to fill the Summary text Field looks like this:
txtCharQuestionsSum.AddText(WinAntagonistActionAntagonistQuestions.CCAntagonistQuestionList3Applied.Text_AntagonistUnusualMannerisms.text) + EndOfLine

Test if the textfield is empty before adding the text with an EndOfLine at the end?


brilliant!:slight_smile: Thanks.