Submitted by Muadib on 2018/02/08 14:27
I have 2 fields: "checkmark_1" & "days_to_mark"
 
In "checkmark_1" field i have row equation: function_mark( [days_to_mark] )
 
In "days_to_mark" field i have list of weekday names
 
"function_mark" code:
 
Function function_mark(to_mark_field)
    Dim today_date
    today_date = WeekDayName(WeekDay(Now()))
    If InStr(to_mark_field, today_date) <> 0 Then
    mark_to_show_habits = -1
    else
    mark_to_show_habits = 0
    End If
End Function
 
Now everything works well, but row equation is not refreshed every day I need to do it manually.
 
Anyone could tell me what's wrong with my setup?
 
Thanks!

Comments

[quote=Muadib]
In "checkmark_1" field i have row equation: function_mark( [days_to_mark] )
Function function_mark(to_mark_field)
    Dim today_date
    today_date = WeekDayName(WeekDay(Now()))
    If InStr(to_mark_field, today_date) <> 0 Then
    mark_to_show_habits = -1
    else
    mark_to_show_habits = 0
    End If
End Function
 
Now everything works well, but row equation is not refreshed every day I need to do it manually.
[/quote]
I see 2 things
  1. Function function_mark: mark_to_show_habits should be the same as the function name
  2. In the field checkmark_1, you must set Auto-update for the row equation
HTH !
 
Pierre_Admin
IQ Designer
 

Muadib

2018/02/09 11:29

In reply to by Pierre_Admin

My bad. I put wrong function, here's the one i use:
 
Function mark_to_show_item(to_mark_field)
    Dim today_date
    today_date = WeekDayName(WeekDay(Now()))
    If InStr(to_mark_field, today_date) <> 0 Then
    mark_to_show_item = -1
    else
    mark_to_show_item = 0
    End If
End Function
 
I have set row equation to Auto-update. Everything works fine, but I need to manually recalculate every day, for some reason auto-update doesn't work.
 
Thanks for help!

Pierre_Admin

2018/02/09 11:57

In reply to by Muadib

[quote=Muadib]
I have set row equation to Auto-update. Everything works fine, but I need to manually recalculate every day, for some reason auto-update doesn't work.
[/quote]
Do other auto-update fields recalculate automatically ?
 
 
Pierre_Admin
IQ Designer
 

Muadib

2018/02/09 12:43

In reply to by Pierre_Admin

Yes. Other fields auto-update

Pierre_Admin

2018/02/09 13:09

In reply to by Muadib

Hi,
 
OK, I looked at the code, and auto-recalc is only triggered if the equation contains a date field. That will probably change in a future version, but for now, you can add a dummy date field to the equation and it should now recalc correctly
 
 
Pierre_Admin
IQ Designer
 

Muadib

2018/02/09 13:29

In reply to by Pierre_Admin

Thanks!
 
Does data field need to contain values?

Pierre_Admin

2018/02/09 14:40

In reply to by Muadib

Unfortunately yes, only items that have a date value will be recalculated. I'll look into improving this in the next version
 
Pierre_Admin
IQ Designer
 

Armando

2018/02/11 22:23

In reply to by Pierre_Admin

 Are you sure? I have a row equation as simple as x = 0, and it gets properly recalculated everyday (in that example, it's a Boolean field that is reset every day).
 
[Edit : let me test it anyway -- maybe I thought it worked and it didn't]

Pierre_Admin

2018/02/12 15:42

In reply to by Armando

[quote=Armando]
 Are you sure? I have a row equation as simple as x = 0, and it gets properly recalculated everyday (in that example, it's a Boolean field that is reset every day).
[/quote]
Correct when removing a value.
When the equation may add a value, it needs to know what items to evaluate (wouldn't want to do it for all items in the database). For this, it was only checking date fields in the row equation
 
Pierre_Admin
IQ Designer
 

Armando

2018/02/12 17:38

In reply to by Pierre_Admin

 I see. Here you go, I had to have that exception in my equations.