Post

2 followers Follow
0
Avatar

Parsing Text for Globiflow Supermenu Checklist items

Hi, I am attempting to modify a task management system that I set up. Using Globiflow Supermenu's mark-down text editor, we utilize a text field called "Task Checklist" in our task application. If applicable, we enter all checklist items associated with that task.

I would like to add an "Open Checklist Items" calculation field that parses out each open checklist item. I would need to parse out every line with [ ] as opposed to [x].

I will then use the "Open Checklist Items" field as part of our daily project management report by collecting all incomplete tasks and displaying the Open Checklist Items.

Any help on how to do this in Javascript would be much appreciated.

The below images are referencing a "File Taxes" Task.

Thanks in advance.

 

Jon Licht

Please sign in to leave a comment.

6 comments

0
Avatar

Hi Jon,

you can try this:

@Task Checklist.replace(/(\[x\].*?\n)/g,"")

That should remove all completed tasks.

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink
1
Avatar

Rainer, that worked perfectly, thank you.

 

Any idea why output.replace ("[ ]", "") isn't working below?  I would like to remove the brackets from the output if possible

 

Jon Licht 1 vote
Comment actions Permalink
1
Avatar
output.replace ("[ ]", "") 

replaces the first occurence of the string [ ]  only. To remove all  occurences of [ ] you need a regEx (regular expression) with a g-flag (g = global):

output.replace(/\[ \] /g,"")

Rainer

Rainer Grabowski 1 vote
Comment actions Permalink
0
Avatar

Rainer,  Sorry, one more thing.  I am running into a small bug.

 

Note in the screenshots below that if I do not have text after the final checklist item, the Open Checklist Items formula will include it in the calculation field as output even when the box is checked.  Is there a way around this other than to add "End Checklist" after every checklist.  I am worried about user error if my associates forget to include this and our reports compile incorrectly.

 

 

Jon Licht 0 votes
Comment actions Permalink
0
Avatar

Hey Jon,

simply add "\n" behind the field token:

var checklist = @Task Checklist + "\n"

Keep the other lines as they are. 

Rainer

Rainer Grabowski 0 votes
Comment actions Permalink