02-16-2022 03:42 PM
Hello everyone,
it's probably a trivial problem, but i can' still solve it.
I have several terms in a combo box and i would like that when one of these terms is clicked, the respective term will appear in a column of a 2D table in a report. I've tried several methods such as for example comboBox.Text etc., but only the first term from the combo box appears in the 2D table.
Thank's a lot for the help.
Best regard
Alexander
02-16-2022 05:04 PM
If you have code that does not work, please attach it so we can see what you are doing wrong.
02-17-2022 03:52 PM
Thank you for the feedback.
I created two Sub procedures in the dialog editor. In the first sub procedure, I fill the combo box with the terms.
In the second sub procedure I create a 2D table with 7 columns with header. In the code you only see the relevant 7 columns. The text is passed to columns 1 - 6 via variables and it works so far.
I hope that I have described my problem understandably.
Thank you for the feedback.
I created two sub procedures in the dialog editor. In the first sub procedure i fill the combo box with the terms (CONTENTOPTION_FILE and OPTION_1 are global variables). In the second sub procedure i create a 2D table with 7 columns with header. In the code you only see the relevant seventh column. The text is passed to columns 1 - 6 via variables and it works so far.
I hope that i described my problem understandably.
Part 1
Sub Option1Box1_EventInitialize(ByRef This)
Dim Option_list(5)
Dim file_path, first_entry, intMyHandle, strMyText, rest_text, index, intMyError, k
file_path = ScriptWritePath&CONTENTOPTION_FILE
first_entry = true
intMyHandle = TextFileOpen(file_path,eTextFileAttributeRead) ' open file
Do While Not TextFileEOF(intMyHandle) ' as long as file contains texts
strMyText = TextFileReadLn(intMyHandle) ' read text from file
if first_entry then
first_entry = false
else
rest_text = strMyText
k = 0
Do While InStr(rest_text, ";")
index = InStr(rest_text, ";")
Option_list(k) = Left(rest_text, index-1)
k = k + 1
rest_text = Mid(rest_text, index+1)
Loop
Option_list(k) = rest_text
Call Option1Box1.Items.Add(Option_list(OPTION_1), k)
end if
loop
intMyError = TextFileClose(intMyHandle) ' close file
End Sub
Part 2
Set oMyColumn7 = oMy2DTable.Columns.Add(e2DTableColumnText)
Set Col7TitleSettings = oMyColumn7.Settings.Header.IndividualTitle
Col7TitleSettings.Enable = True
Col7TitleSettings.Title2 = "Test"
oMyColumn7.Settings.Font.Size = 2
oMyColumn7.Settings.Alignment = eTableAlignmentCentric
oMyColumn7.TextList(1).Text = Option1Box1.Text
02-18-2022 03:01 AM
Hi Alexander_18,
Please find attached a simplified example for your request.
You can select in a combo box an item and if you select the button this selected text is added in the table. The text is stored in a text array.
Greetings
Walter
02-18-2022 03:06 PM
Hello Walter_Rick,
thank you for your support.
I have to fill the combo box with terms from a csv-file (see Part 1). Then I want to have a 2D table with 7 columns in a report and one column of it should be filled with the term that is selected from the combo box (see Part 2). The 2D table already exists in the report with different terms in columns 1 to 6. I only have to fill the seventh column with a selected term from the combo box. In practice it should be look like this: I select a term via the combo box and then press a button and in the already existing 2D table the selected term should appear in the the 2D table column of a report.
I would be happy if someone can help me.
Greetings
Alexander
02-21-2022 01:46 AM
Hi Alexander,
You have two options within a REPORT 2D table to realize your request. Option one is a text channel which is displayed in the table and option two is a text list column. For the first option you can add a new text to the channel and refresh the layout and in the second case you change the column in the table. Attached you find an example for both options.
Greetings
Walter