Welcome Guest

Pages: 1
Initial field value
UKenGBPostNovember 25, 2021, 15:02
Advanced
Posts: 57
Registered:
April 30, 2020, 09:36
Normal topicInitial field value

I'm trying to test the initial value of a field, but cannot see any way to do this, apart from copying it to a (named) variable and then testing that. Is there any way to avoid that extra step and test the initial field value directly?

2MR2PostNovember 25, 2021, 15:12
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicInitial field value

The initial value of every simple field is available via an escape sequence. From any action statement's text field's context menu you can insert the sequence via the Insert Yate Initial Field submenu. The escape sequence is:

\{field name} eg. \{title}

Note that the mailer strips backslashes while the forum does not.

2MR2PostNovember 25, 2021, 21:17
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicInitial field value

v6.7 will extend the User Defined Fields statement so that initial values of UDTIs, etc. can be read.

UKenGBPostNovember 27, 2021, 04:15
Advanced
Posts: 57
Registered:
April 30, 2020, 09:36
Normal topicInitial field value

Yes I know about the escape sequences in a TEXT field, but that cannot be used where a named parameter (etc) is expected. So it is possible to compare a field's current value to some text string or indeed any field's initial value (entered in the text field), but it is not possible (that I could see) to compare the initial value to that text string, Entering the appropriate escape sequence into the box where the 'named parameter' is expected does not work. It is accepted, but the test doesn't work.

I was able to use a different (current) field to achieve the same result, but it would be handy to be able to compare the initial field against the text string.

2MR2PostNovember 27, 2021, 08:07
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicInitial field value

Entering the escape sequences in a named variable field would definitely not work as you would just be using the initial field's value to determine the name of the named variable.

The Compare Text, Compare Numeric and Compare Dates statements attempt to make things easier by forcing the left and right operands into certain rigid types. The left operand is a field, a named variable or a track variable (which is really a field). The source of the left operand determines the runtime behaviour of the statement. Not merely in the source determination but also how many times the operation takes place.

It would be useful to be able to have left operands of a field's initial value, a runtime setting and more than likely other things as well. However, the controls implemented to determine the left operand are quite complex and I am more than loathe to modify them. Regardless as to what I add there will eventually be a need for something else.

The only workable solution is to add a raw text mode which would always compare two text strings which could contain any escape sequences. In order to keep things consistent this would be treated similar to having the source in a track variable and would be run over every active file ... necessitating a once option to be able to override this behaviour.

This may be easy to implement. If it is, it might appear in v6.7. If not it'll have to wait for a subsequent release.

It does make sense. Personally I'm always having to load runtime settings into named variables before comparing.

UKenGBPostNovember 27, 2021, 12:50
Advanced
Posts: 57
Registered:
April 30, 2020, 09:36
Normal topicInitial field value

Yes there are ways around it using additional variables, but I do like the idea of a 'raw text' comparison. That way, we can compare anything. I'll have to keep my eye out for it.

Thanks.

2MR2PostNovember 28, 2021, 15:05
Avatar photo
Administrator
Posts: 2083
Registered:
August 23, 2012, 19:27
Normal topicInitial field value

Turns out it was easy and I was able to do it in the same control that choses the left operand type. The choices are now:

Named Variable, Text, Property, Variables

There is also a new Once option to limit the execution when Text is chosen.

This was done in Compare Text, Compare Date and Compare Numeric.

It'll be in v6.7

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.021 seconds.