Loading...
 
Skip to main content

Category: Advanced Rating Language / Mathematical calculation tracker field

Advanced Rating Language / Mathematical calculation tracker field
Show subcategories objects

Name Type
15.x: Recalculate mathematical calculation tracker field at indexing time fails
15.x: Recalculate mathematical calculation tracker field at indexing time fails
The tracker field was set to that option: Recalculate on indexing.
If you set the tracker field to recalculate on save, it works as expected.
tracker item
Add foreach / concat calculation function on dynamic itemList field type (like we have with itemList)
The foreach / concat calculation that is possible to run on the itemList field is very useful for matching and advanced calculation. However itemList doesn't permit selection of items (row). So it is all or nothing.

We should add the same functionality on the dynamic itemList that populate on the fly (after user selection) and allow selecting all or part of the displayed items (rows). It will solve a lot of issues and avoid the creation of several trackers to force event cascading (creation / selection / report)

Use case: I need the user to select an activity then select dates from a dynamic item list (dynamic as dates are different for each activity) and on save to have the cost calculated (activity price * activity days selected). This would be easy if I could use the foreach / concat calculation thing but for now I need at least 2 trackers and 2 different steps for the users (and 3 to 4 extra fields).
tracker item
Add natural sorting of Priority field in the bug tracker at dev.t.o
We need to provide natural sorting of the -+Priority+- field in the bug tracker at dev.t.o
Example: click at sort bugs in the wishlist page by Priority in descending order:
https://dev.tiki.org/tiki-index.php?session_filters=y&tr_sort_mode1=f_138_desc&page=Wishlist

First, items with priority 90 are shown.

After that, items with priority 9 are shown. However, between 9 and 90 there are lots of priorities that should be shown before 9 is shown, if they were understood as numbers, not as characters.

See:
https://www.php.net/manual/en/function.natsort.php
tracker item
Advanced Rating syntax: Empty date tracker-field shows data through Mathematical calculation tracker field
Empty date tracker-field shows data through Mathematical calculation tracker field


An item from our intranet (item65 ) has no value at a date field (trkDeliveryDate). trkDeliveryDate is a date field (date picker) with only date, and no default value set in this preference.

Field trkDeliveryMonth is a Mathematical calculation tracker field, extracting the month from that date field, which should be empty, but it's not, it shows some month (current month, I don't know if by chance or by which means).

trkDeliveryMonth:
{CODE()}
(date (str y-m) trkDeliveryDate)
{CODE}
tracker item
Better verbose on empty calculation field
When a calculation field is empty it stop the index rebuild operation.

In the console it throw an none very instructive error:
{CODE()}
[root@server html]# php console.php i:r --log
[04-03-2020 16:20] Started rebuilding index... logging to file: /tmp/Search_Indexer_mysql_xxxxx_tiki21_console.log
Unified search engine: MySQL, version 10.1.44-MariaDB
error: The search index could not be rebuilt.
Expecting "(" near ""
{CODE}

#The error should be explicit: Field (permaname and Id) is empty or misconfigured.
#The index should jump over and continue
tracker item
Change in condition inside a calculation field (breaks rebuilt index operation and calculation)
Due to (I guess) change in the calculation field, the if condition or the way the index is rebuilt a previous condition to perform a calculation stopped to work and interfere with the rebuild index operation.

{CODE(caption="calculation that doesn't work")}
(if timeworkDateIn (round (div (sub timeworkDateOut timeworkDateIn) 3600)1))
{CODE}

The "if" here was checking if there is a value in the field "timeworkDateIn" to avoid a different error (Divide by zero on "0") that was displayed to the visitor of the site. After I upgrade this Tiki20 to Tiki21 I got an error on rebuild index:
{CODE()}
[root@server html]# php console.php i:r --log
[04-03-2020 09:48] Started rebuilding index... logging to file: /tmp/Search_Indexer_mysql_tsaharoniki_tiki21_console.log
Unified search engine: MySQL, version 10.1.44-MariaDB
error: The search index could not be rebuilt.
Variable not found "timeworkDateIn".
.../...
2020-03-04T09:48:36+02:00 INFO (6): addDocument trackeritem 53 {"memoryUsage":"22.3 MiB"}
(where it stopped)
{CODE}

I found a workaround see below, but we should have a way to keep it as is or to better verbose so the admin knows what to do.

{FADE(label="Long story" icon="y")}
I have a field that calculate time from 2 dates field to set a work clock.
Worker enter when he come to work and when he get out.
The calculation is done on save so data are updated constantly and the user can see results in real time.

{img fileId="1374" thumb="box"}

It was working fine on Tiki20.

Since I upgraded to Tiki21 it has stopped to work.
(on the sample a new employee entered 3 row after the Tiki was upgraded)
{img fileId="1375" thumb="box"}

@Roberto: I think we have similar case setup as we worked together on some solution for a "Tiki" company :-) but else I can provide playground to help.

!!!Update1
I got an error on rebuild index:
{CODE()}
[root@server html]# php console.php i:r --log
[04-03-2020 09:48] Started rebuilding index... logging to file: /tmp/Search_Indexer_mysql_tsaharoniki_tiki21_console.log
Unified search engine: MySQL, version 10.1.44-MariaDB
error: The search index could not be rebuilt.
Variable not found "timeworkDateIn".
.../...
2020-03-04T09:48:36+02:00 INFO (6): addDocument trackeritem 53 {"memoryUsage":"22.3 MiB"}
(where it stopped)
{CODE}

trackeritem 53 is an old work clock item (closed).
The calculation was ok and all field looked ok.
I edited and saved and had the following error:
{CODE()}
The search index could not be updated. The site is misconfigured. Contact an administrator.
Variable not found "timeworkDateIn".
{CODE}

The field is here and the permaname is correct:
{img fileId="1376" thumb="box"}

Retested on the same Tiki still on version 20 (I kept for test) and there it is working fine.
(calculaltion are made, indexing is ok)

I escalated the bug to upgrade blocker.
If something corrupt a working index or block Tiki from indexing then it just kill the website (IMO).

!!!Update2
Above I see that the operation stopped very early, trackeritem 53 (I have more than 1500 trackeritems).
It stopped because it couldn’t find the field "timeworkDateIn" during a calculation.

I have 2 calculation field that use the same field "timeworkDateIn"
If I keep the first one and remove the second it work:
{CODE(caption="First calculation")}
(concat (date (str F) (str-to-time (str +0 day) timeworkDateIn)) (str |) timeworkName)
{CODE}

{CODE(caption="second calculation that doesn't work")}
(if timeworkDateIn (round (div (sub timeworkDateOut timeworkDateIn) 3600)1))
{CODE}

I reworked the code starting by the smallest value and up till the complete formula;
From: (sub timeworkDateOut timeworkDateIn)
To: (if (IsEmpty timeworkDateIn) NA (round (div (sub timeworkDateOut timeworkDateIn) 3600)1))
{FADE}

tracker item
Counting items in Items List Doesn't Work due to lack of , between items
Taken from: https://doc.tiki.org/Calculations
"You can use it with spli-list to count the number of items in a list or in an item-link (should work with item-list dynamic item-list). "
EXAMPLE GIVEN
Let say I have an item-link permanameBooks with 12 items linked.
(count
(split-list
(content permanameBooks)
(separator ,)
(key a)
)
)
-> 12

If you do a (concat permanameBooks) it just gives ArrayArrayArray so split list cannot work

I am going to try and add the , by using the format option with %0,
tracker item
Implement bonus point in the "Ease Importance Priority" calculation
Please see bonus point section of ((Ease Importance Priority))
tracker item
Improve the Mathematical Calculation Tracker Field type to include Javascript and/or PHP
The Mathematical Calculation Tracker Field type should be improved in a way to be able to use Javascript and/or PHP code elements for calculations
(in fact maybe all areas where currently the mathematical calculation logic is used in Tiki could be improved by including Javascript and/or PHP).

This would greatly improve the possibilities and power of Tiki and Trackers to include more advanced calculation and logic into the Tiki system.
tracker item
Mathematical Calculation Field, "Less-Than" function has Logical Error
Create a tracker with a Numeric and a Mathematical Calculation Field.
I want to append a zero to numbers less than 10 to patch a tracker sort order listing issue
(if (less-than testingtrackerNum 10)
(concat 0 testingtrackerNum) testingtrackerNum
)

The above function adds a zero to any number less than 11. Even though the upper test limit is 10.
So the test (less-than 10 10) will be true, which is not the case in reality .
Look at the attached screen grab too
tracker item
Mathematical Calculation on Item List cannot concat the items
on tiki 25.3
The following will work
(count
(for-each
(list parent)
(formula (coalesce childrenNames))
)
)
it outputs e.g. 10

But if you want to see the actual childrenNames you just see Array as the answer
(for-each
(list Parent)
(formula (concat childrenNames))
)

Output=Array
As seen in attachment
tracker item
Tracker Rules
We often need a way to do conditional things in tracker forms, like show or hide fields depending on the user's input, or require validation on some fields depending on the state of others.

So this is to start a discussion about how this should be implemented, should it be a new field type? Or a function of the tracker plugin (which needs significant tidying up) or what?

So they should look something like:

* Category field
** If Category contains "bug" then
*** Show Workaround and Solution fields
*** Make Importance and Easy To Solve required
tracker item
Trackers, Mathematical field; Better verbose on error when the parameter Calculation is empty
On a Tiki24 (any Tiki ;-) ) in a tracker, when you use a Mathematical field and save it with the Calculation parameter empty, on item save the field value displayed the following error :

-+Expecting "(" near ""+-

It is wrong and doesn't really help.
tracker item
Using a $ in a mathematical tracker field (rating, calculation language) broke it
Trying to set up a manual currency exchange method I used the dollar sign "$" in a mathematical field to add it visually as a string.

(str $)

Since then the field is broken and it kept displaying the last version of the value that was calculated (before I change the euro sign to dollar sign)

I refreshed, flushed and rebuilt several time.
I have the feeling the Tiki is acting a bit weird now. ?

Seems it was interpreted as a "coding" value and not as an "ascii" char.

{img fileId="1534" thumb="box"}
{img fileId="1535" thumb="box"}
{img fileId="1536" thumb="box"}
{img fileId="1537" thumb="box"}
tracker item
Wiki page tracker field can't use results from mathematical calculation (formula using strings) due to parse order
We have a tracker where we use a "Wiki page"-tracker-field.
This field uses as page name the results of a mathematical calculation tracker field, which inscludes a formula concatenating strings and tracker item id).
The mathematical calculation tracker field is set to calculate at save time (not at indexing time).

The error message when inserting a new tracker item seems to be related to the order, as if the results from the mathematical calculation field are not available for the wiki page tracker field when the new tracker item is being created:

{QUOTE()}
Error. Missing Page Name field #XX value for Wiki field #YY (so page not created)
{QUOTE}

{img fileId="1330" thumb="box"}

This implies that if the user adds plenty of content (at tracker item creation time) to the text area of the wiki page field, that content is lost.
tracker item
Error after saving a ticket at dev.t.o
There is an error after saving an item in the tracker 5 (whishlist).

"preg_quote(): Argument #1 ($str) must be of type string, Math_Formula_Element given"

The ticket is saved.
Editing a ticket is ok (seems it happend only when saving a new ticket for the first time).
tracker item
Show PHP error messages