veerle
10th March 2003, 18:12
How can I check if a text field has changed?

I use the function with.old.object.values.do() to compare the contents of the fields in my DAL. The problem is of course that I only get the text number of the textfield.

Thanks, Veerle

NPRao
10th March 2003, 20:50
Refer to the predefined variable -

long attr.changed 4R
Indicates if the current field has changed.

or

fieldname.check() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_dal_fieldname_check)

kammie
11th March 2003, 17:35
I remember that some time ago I had the same problem as you: When you change the text, the text number remains the same.

I hope for that the function NPRao is suggesting, is working, otherwise there is the option to write the text to a ascii file before starting the Text Manager, and when the Text Manager is closed, write the text to another ascii file.
After that, you can check whether these files are exactly the same, or not!

NPRao
11th March 2003, 22:25
Kammie, you are right I tested it today that the attr.change or the fieldname.check/has.changed didnt work for the text fields.

Your idea does work and I found another alternative -

You can use the text.to.buf() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_text_fields_text_to_buf) before the program is started and then again when the session is exiting or saving data, then compare the memory/array buffers - cmp.mem() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_memory_operations_cmp_mem)

In this way you can avoid the output file of the $BSE/bin/diff6.2 and just get the return values from the cmp.mem() function to make it easier.

veerle
12th March 2003, 11:49
I have used the text.to.buf() and cmp.mem() functions and it works fine now.

Thanks a lot!

Veerle

NPRao
8th July 2004, 22:25
Veerle,

I found a standard function to do this -


tgbrg0005.text.compare
long tgbrg0005.text.compare( string language(1), string text1(17),
string text2(17) )


To compare two texts. The function returns true if the two
texts are the same and false if they are not. The function
returns -1 if an error occured.

So we dont have to reinvent the wheel. :)

JaapJD
9th July 2004, 14:25
The tgbrg0005.text.compare function still needs two different text numbers, so it cannot be used to check the changes in a text after choice text.manager.