Tinderbox Forum

Problem with DisplayExpression and testing for attributes

Hi, I have a problem with a DisplayExpression that tests for the content of attributes. It works with one, but fails when I add two more. Let me show an example (which is on the prototype):

$Name + " - " + $Submitting_Author.split(", “).at(0) + " - " + $Manuscript_Title.words(5) + if($Manuscript_Type==“Special Issue Article”){” (SI)"} + if($Status_Article==“Rejected”){" (rej)"} + if($Status_Article==“Accepted”){" (acc)"};

The DisplayExpression works well up to testing for “Special Issue Article” - it duly adds the “(SI)”. But when I add the rest, it has no effect - there is no error message, but also no “(rej)” or “(acc)” added.

Can anyone see the obvious error that I fail to see, or have a solution? I am puzzled (and have been working on this for some time…).

Many thanks in advance!

I don’t see the problem at once, though I’d check to make sure that you’re using straight quotes and not typographic quotes.

But this is doing a lot of work for a DisplayExpression, which is evaluated afresh every time the name appears. That’s OK if you need it, but articles (alas!) aren’t accepted every few seconds, not even if you have a small army of diligent graduate students.

What I’d do is build the string to be displayed in a string attribute — we’ll call it $Status. For testing I’d use a Rule, which might eventually become an edict. Then you could so something like this:

$Status=$Name + " - " + $Submitting_Author.split(", ").at(0) + " - " + $Manuscript_Title.words(5) ;
if($Manuscript_Type=="Special Issue Article"){$Status += " (SI)";} 
if($Status_Article==“Rejected”){$Status += " (rej)";} 
if($Status_Article==“Accepted”){$Status += " (acc)";};

I think that makes your intention clearer, and it gives you a place to take other actions when papers are accepted or rejected.

1 Like

Many thanks, Mark - I am happy you don’t see an obvious mistake, and I am happy for pointing out a better (and less resource hungry) way of achieving my goal! Even if an M1Pro Mac will soon grace my desk (jay!), I am eager to learn an efficient style of achieving what I want in Tinderbox.

Spent half a day today on my system of keeping track of editorial work (thankfully, the Manuscript Central system allows easy exporting of submitted articles’ data via CSV - which just need to be dropped into a Tinderbox container, with an OnAdd assigning the prototype), and it will make my workflow much easier.

Once I’ve fully grokked the linking system @satikusala so kindly demonstrated in his brilliant video on the topic, I will implement it, too – many thanks, Michael!

1 Like

Looking at the code again in the bigger font of the forum, the answer is obvious - I used curly (smart) quotes rather than straight ones. So that will have been the cause why it didn’t run; but I am happy I learned a better way through asking!

1 Like