Reputation: 2169
I have a formula based on a field value called TTArs
(it is a computed date/time field showing only the time, eg: 15:31, which is calculated based on other two editable date/time fields. In other words, it is the difference between the other 2 date/time fields).
The formula is something like this:
@Hour(TTArs)*60+@Minute(TTArs)
I want to calculate all the minutes in that field time displayed on that field.
The result it should be a number (I guess). I want to display it on a column in a view, but it is showing an error on that column in view:
Incorrect Data type for operator or @Function Time/Date expected.
I created a hidden field on the form where I want to store the number of minutes from the difference between the 2 date/time fields, it is computed, its name is "Untitled".
Here's the code
@If(text_orarezrs=null | text_oratrimrs=null; @Return(""); "");
seconds := text_orarezrs-text_oratrimrs;
minutes := @Integer(seconds/60);
output := @Text(minutes);
@SetField("Untitled";output)
text_orarezrs
and text_oratrimrs
are the 2 date/time fields (they are not text fields). But it doesn't show anything on the field.
Upvotes: 0
Views: 2385
Reputation: 823
Florin! I presume that the field you want to use on the view is the one we computed in your last question? If so, please stop and think - in that formula, you created a text value, even though it is displaying a time ("hh:mm"). So you now have two options if you want to display that in a view as a number of minutes.
Personally, I would do the second one of these. All you need is to check that neither field is null, then subtract one from the other, then divide by 60 (you remember that date/time - date/time always gives the answer in seconds, of course).
Happy coding, Phil
Upvotes: 1