BaBernd
10th September 2016, 14:33
Hello to All,

I'd like to change a label in the session mask of a print session within the program script for this session.

1.) I've created 2 labels with different text as "common label". When I try to insert that label with the form editor in the field properties "Label" then I get the error: "No label present for Detail Session with this LabelCode". I've not forgotten to compile the new labels for my paket-VRC.

2.) How is the command code for the program script to change between this to labels, if I switch the check box property of that field between tcyesno.no and tcyesno.yes during runtime.

Best Regards Bernd

srprks
12th September 2016, 06:46
function long change.field.label (const string fname, long element, const string label1 [, const string label2] [, const string label3])


after.form.read:
change.field.label("ttadv200.cpac",1,"01234567890123456789")
| Now 20 characters will be reserved for the label of
| the specified field, later the new value can be set.

BaBernd
13th September 2016, 10:39
Hello Srprks,
thanks for help. Here I've some remarks:
I think with that function you mentioned I can change the field label from a database table. That's not what I'm looking for. I'd like to change a graphic user interface so I believe I've to use the "User Interface Objects" and the related functions and objects like "DsCcheckBox". For that I'm searching some example how to implement these objects for changing a label within an session window. Maybe you can help with that point.
Best Regards Bernd

bhushanchanda
13th September 2016, 11:54
1.) I've created 2 labels with different text as "common label". When I try to insert that label with the form editor in the field properties "Label" then I get the error: "No label present for Detail Session with this LabelCode". I've not forgotten to compile the new labels for my paket-VRC.

In the form editor, under Label tab, type some part of your label text and click on search. Check if it opens up a session with your label. Now, you can select your label and it should be done.

e.g. if my label code is xxyyzzzz and text is "Hello World", I can simply type in the description box something like Hello and click on search to get my label.

Post some screenshots if that doesn't work.


2.) How is the command code for the program script to change between this to labels, if I switch the check box property of that field between tcyesno.no and tcyesno.yes during runtime.


As someone already posted, you can use change.field.label() to change your labels at runtime based on some condition. Something like this -

declaration:
extern domain tcyesno test.f

field.test.f:
when.field.changes:

if test.f = tcyesno.yes then
change.field.label("test.f",1,"You clicked yes")
else
change.field.label("test.f",1,"You clicked no")
endif

This should work unless you are not building your own session programmatically.

BaBernd
19th September 2016, 12:32
Hello Srprks, Hello Bhushan,

1.) It works as Bhushan described. Thanks a lot!

2.) the function change.field.labels also works very fine. But now I've recognized that it will be better to change the label-name instead of the label-description, cause of language changes. Is that also possible? Which function I've to use instead?

Best Regards
Bernd

bhushanchanda
19th September 2016, 13:40
In that case, you can use tt.label.desc.by.lang()

e.g.

my_label = tt.label.desc.by.lang("tccom122.12","2") |#English
my_label = tt.label.desc.by.lang("tccom122.12","4") |#French

You can then pass my_label variable to change.field.label() function.

BaBernd
19th September 2016, 16:19
Hi Bhushan,

you saved my day! Thanks a lot, it's running :-)

Best Regards
Bernd