Loading...
 

Tikiwiki-devel (mailman list mirror)


String Manipulation in Relational Trackers

Hi Brendan,

Concat function in Match Calc field definitely works, I am using it on
several sites. Here's an example from one of them:

(concat (date (str Y-m-d) grantDate) (str " ") grantPrice)

Here, grantDate is a Date/Time tracker field, so we are parsing it using
the date function and then concatenating the grantPrice which is another
tracker field. We also separate by empty space. This goes directly into
the Calculation param of the field.

Please also make sure Re-calculation event is save, so the field updates
on each item save operation. Otherwise, you will need to rebuild the
index in order to have it recalculated.

Regards,
Victor


On 10/11/2018 06:35 PM, Brendan Ferguson wrote:
> Hi Guys
>
> I would like to create a unique identifier for a tracker item based on content previously filled out and also data contained within linked tracker items (via itemLink or Relations)
>
> I'm having difficulties figuring out how to perform simple string manipulation even within the same tracker. The Mathematical Calculation field says it employs Advanced Rating calculations, but none of the string functions of Advanced Rating seem to work.
>
> Any clues as to how I would create a tracker field with:
>
> textField: GA1
> Language: de
>
> To equal GA1-de?
>
> Or is this something Tiki currently can't handle?
>
> Thanks
>
> Brendan
>
> ___
> TikiWiki-devel mailing list
> TikiWiki-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel



___
TikiWiki-devel mailing list
TikiWiki-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel

posts: 43779 Canada

Victor, thanks for the explanation. I am able to get it to work now. Seems as though I didn't fully (and still don't) get the syntax. So I was creating variables when I wanted strings and vice versa.

Do you know if its possible to reference values from Item Link fields? Like thisField.itemLinkField. I can use thisField to get the int value of the linked reference, but don't see any documentation on retrieving value(s) within the linked fields. My guess is that is not currently implemented, but was hoping you may even know a workaround or something of the sort.

Brendan


> On Oct 12, 2018, at 10:16 AM, Victor Emanouilov <victor@tiki.org> wrote:
>
> Hi Brendan,
>
> Concat function in Match Calc field definitely works, I am using it on several sites. Here's an example from one of them:
>
> (concat (date (str Y-m-d) grantDate) (str " ") grantPrice)
>
> Here, grantDate is a Date/Time tracker field, so we are parsing it using the date function and then concatenating the grantPrice which is another tracker field. We also separate by empty space. This goes directly into the Calculation param of the field.
>
> Please also make sure Re-calculation event is save, so the field updates on each item save operation. Otherwise, you will need to rebuild the index in order to have it recalculated.
>
> Regards,
> Victor
>
>
> On 10/11/2018 06:35 PM, Brendan Ferguson wrote:
>> Hi Guys
>>
>> I would like to create a unique identifier for a tracker item based on content previously filled out and also data contained within linked tracker items (via itemLink or Relations)
>>
>> I'm having difficulties figuring out how to perform simple string manipulation even within the same tracker. The Mathematical Calculation field says it employs Advanced Rating calculations, but none of the string functions of Advanced Rating seem to work.
>>
>> Any clues as to how I would create a tracker field with:
>>
>> textField: GA1
>> Language: de
>>
>> To equal GA1-de?
>>
>> Or is this something Tiki currently can't handle?
>>
>> Thanks
>>
>> Brendan
>>
>> ___
>> TikiWiki-devel mailing list
>> TikiWiki-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>
>
>
> ___
> TikiWiki-devel mailing list
> TikiWiki-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel



___
TikiWiki-devel mailing list
TikiWiki-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel

Yes, there is a workaround but rather ugly. We are planning on expanding
the Math calculations to work better with linked fields but until that
happens, let me give you an example how you can include fields from a
linked tracker:

(if (add (for-each (list declinedWithdrawnDateList) (formula (less-than
dwDeclinedWithdrawnDate (str-to-time reportDate)))))
  (date (str Y-m-d) (add (for-each (list declinedWithdrawnDateList)
(formula (concat dwDeclinedWithdrawnDate)))))
  (str )
)

You use for-each, list and formula functions. Here,
declinedWithdrawnDateList is an ItemsList field - it lists fields from
other tracker connected via ItemLink. So, you can basically get any
field from the other tracker in the current tracker using ItemsList
field. Since it is an array, we use for-each and list functions to
iterate and then inside the formula you can use whatever you need on the
remote tracker field - dwDeclinedWithdrawnDate in our example.
dwDeclinedWithdrawnDate is a field in the remote tracker. I have made
this extension in Tiki 18, so you can include any of the fields in the
remote tracker and use it in a formula. You need an ItemsList connection
first.

Also, note that since for-each iterates an array, we use one of the add
or contact functions to aggregate the results into a scalar value.
Otherwise, it will return an array and you will get wrong results.

As I said, it is ugly but working. Hope to get to the revamp part of
this by Tiki 20!

Regards,
Victor

On 10/12/2018 07:44 PM, Brendan Ferguson wrote:
> Victor, thanks for the explanation. I am able to get it to work now. Seems as though I didn't fully (and still don't) get the syntax. So I was creating variables when I wanted strings and vice versa.
>
> Do you know if its possible to reference values from Item Link fields? Like thisField.itemLinkField. I can use thisField to get the int value of the linked reference, but don't see any documentation on retrieving value(s) within the linked fields. My guess is that is not currently implemented, but was hoping you may even know a workaround or something of the sort.
>
> Brendan
>
>
>> On Oct 12, 2018, at 10:16 AM, Victor Emanouilov <victor@tiki.org> wrote:
>>
>> Hi Brendan,
>>
>> Concat function in Match Calc field definitely works, I am using it on several sites. Here's an example from one of them:
>>
>> (concat (date (str Y-m-d) grantDate) (str " ") grantPrice)
>>
>> Here, grantDate is a Date/Time tracker field, so we are parsing it using the date function and then concatenating the grantPrice which is another tracker field. We also separate by empty space. This goes directly into the Calculation param of the field.
>>
>> Please also make sure Re-calculation event is save, so the field updates on each item save operation. Otherwise, you will need to rebuild the index in order to have it recalculated.
>>
>> Regards,
>> Victor
>>
>>
>> On 10/11/2018 06:35 PM, Brendan Ferguson wrote:
>>> Hi Guys
>>>
>>> I would like to create a unique identifier for a tracker item based on content previously filled out and also data contained within linked tracker items (via itemLink or Relations)
>>>
>>> I'm having difficulties figuring out how to perform simple string manipulation even within the same tracker. The Mathematical Calculation field says it employs Advanced Rating calculations, but none of the string functions of Advanced Rating seem to work.
>>>
>>> Any clues as to how I would create a tracker field with:
>>>
>>> textField: GA1
>>> Language: de
>>>
>>> To equal GA1-de?
>>>
>>> Or is this something Tiki currently can't handle?
>>>
>>> Thanks
>>>
>>> Brendan
>>>
>>> ___
>>> TikiWiki-devel mailing list
>>> TikiWiki-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>>
>>
>> ___
>> TikiWiki-devel mailing list
>> TikiWiki-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel
>
>
> ___
> TikiWiki-devel mailing list
> TikiWiki-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel



___
TikiWiki-devel mailing list
TikiWiki-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tikiwiki-devel


Why Register?

Register at tiki.org and you'll be able to use the account at any *.tiki.org site, thanks to the InterTiki feature. A valid email address is required to receive site notifications and occasional newsletters. You can opt out of these items at any time.