"-" in DisplayExpression


(Ralph Cramer) #1

Hi all,

I am experimenting a little bit with task paper export from omnifocus and import of this export into tinderbox.

For this, I have created a simple agent to adapt the DisplayExpression containing only the characters of the task name before the first “@”. Doing this, it looks like Tinderbox has an issue with having DisplayExpression started with a “-” as first character.

Having the following agent running
var addPOS(2); addPOS=$Name.find("@"); $DisplayExpression=$Name.substr(0,addPOS)

is generating the following task list

-0
-0
-0

Changing it to
$DisplayExpression=$Name.substr(1,addPOS-1)

everything looks like expected, but missing the “-” as first character

Vertrieb
Verabredung ausmachen
Agile User Group

Because I am a little bit confused because of this behavior, it would be great to get some idea of the mistake I have done here.

Thanks


(eastgate) #2

The display expression is an expression – a formula that Tinderbox evaluates to compute the display name. Thus, if the display expression was

2+2

your display nam would be

4

In your case, the display expression

$addPos

might be exactly what you want.


(Ralph Cramer) #3

Thanks, but addPOS will contain the number of the first occurrence of “@” in $Name.
Correct ?

Example:
$Name is “-Vertrieb @parallel(true)” => addPOS value is 11

Now, I want to set the first 10 characters of $Name as $DisplayExpression. So, I tried to use substr(0,$addPOS-1)

Thanks for any help.


(Ralph Cramer) #4

Solved. I have found the correct way setting the formula in " " in the agent

addPOS=$Name.find("@"); $DisplayExpression=“substr($Name,0,$addPOS-1)”

Thanks for our hint!


(Mark Anderson) #5

Surely, if the first expression uses an attribute ‘addPOPS’ then it should really be:

$addPOS=$Name.find("@");

In current syntax, I think the expression would be:

$addPOS=$Name.find("@");$DisplayExpression='$Name.substr(0,$addPOS-1)';

Presuming $addPOS is a number-type attribute holding the .find() match position, we can move some calculation of the display expression which is generally a good thing:

$addPOS=$Name.find("@")-1;$DisplayExpression='$Name.substr(0,$addPOS)';

(eastgate) #6

Then your display expression should be

 substr(0,$addPOS-1)

If you set this as an action, then

$DisplayExpression="substr(0,$addPOS-1)"

(Ralph Cramer) #7

Thanks Mark. Important lessons learned was the usage of the hyphen in the expression.


(Ralph Cramer) #8

Thanks Mark! Tried it in a new file and it worked. Maybe something was not correctly initialised in the other tbx.