Quantcast
Channel: MobileRead Forums
Viewing all articles
Browse latest Browse all 50069

Template: Working with if-elif

$
0
0
Hello,

I have a custom column that shows the days spent on reading a book. I am trying to create another column that shows the text value based on the days spent. Here is the code I am using:
Code:

program:
        p = $$#daystaken;
       
        if p < 4  then 'Fast Paced'
        elif ((p >= 4) && (p < 8)) then 'Medium Paced'
        elif p >=8 then 'Slow Paced'
        fi

The problem is that my code doesn't work. For example, days spent = 11 and I am expecting the column to show 'Slow Paced' but it is currently showing 'Fast Paced'. Also, funny thing is that if the days are between 0-9, it works but it doesn't work if days >= 10. Can someone guide me please? :))

:help:

Viewing all articles
Browse latest Browse all 50069

Latest Images

Trending Articles



Latest Images