Post

2 followers Follow
0
Avatar

Extract a date from a textfield via calculationfield/regex

Dear community,

I have an app with two fields - see picture below. My problem is that I want the date marked with a GREEN square in the text field moved to the calculation field. I would prefer a format which allows me to afterwards place it in a 'date field' via the Podio workflow, but this is not a requirement.

I could only find one related post on the forum, which made me think that regex could be used since I have multiple lines and there are two dates to pick from, but I always want to extract the lower date (in the GREEn square writen after 'Hvonår:'  - which means when).

 

Link to related post on forum: https://help.podio.com/hc/en-us/community/posts/115001178291-Extract-data-between-2-strings-via-regex?input_string=Extract

 

Is it possible to make this in a calculation field in Podio? Perhaps gobiflow or something els is needed?

WHY IS IT INTERESTING: If this can be solved, then we are able to sent a specific calender meeting from Outlook into a workspace in Podio with using 'Email to app' function in the workspace.

 

I therefore hope somebody has some ideas on this.

 

Best regards

Malte

 

 

 

Malte Sandvej Thomsen

Please sign in to leave a comment.

5 comments

0
Avatar

Hi Malte,

first of all: " I would prefer a format which allows me to afterwards place it in a 'date field' via the Podio workflow, but this is not a requirement."
That isn't possible, cause a Podio Flow can't pull values from a calculation field.

To get the wanted substring you don't need a regex. This gets it:

 @Text.split("'Hvonår: ").pop().split("\n").shift()

But to popluate a date field with start/end date you need Globiflow. And if you use Globiflow for populating you don't need the calculation field cause you can do the string to date conversion in the flow.

Rainer

Rainer Grabowski 0 votes
0
Avatar

Hi Rainer,

Thanks a lot for your fast respons :)

I ended using the code below and it seems to work perfect, so I just get the date.

@Text.split("Hvornår: ").pop().split("(UTC").shift("")

 

Malte Sandvej Thomsen 0 votes
1
Avatar

Hi Rainer/users,

I have a problem with Podio showing dates differently depending on where I look in Podio, when I use this metode.

I use the following methode described in this topic: https://help.podio.com/hc/en-us/community/posts/115003342691-Extract-a-date-from-a-textfield-via-calculationfield-regex

Currently I use this code: 

 @Text.split("Hvonår: ").pop().split("\n").shift()

I'm therefor extracting a date from a textfield via calculationfield and when I look in the app overview it all stands correct, but when I open the meeting it shows a wrong date. The date showing in the open meeting dosen't appear in the textfield I extract from and it is always changing the date to the 1. date in the month.

I have tracked the following system:
If the correct date is the 30 January it changes to the 1. January.
If the correct date is the 20 March it changes to the 1. March
and so on..

Do you have any ideas what might go wrong? Is it the code or Podio?



Malte Sandvej Thomsen 1 vote
1
Avatar

Hi Malte,

the calculation field takes "30. " (digit plus dot plus blank space at teh beginning of a line) as the beginnig of a numbered list and converts it automatically to nr. 1 in the list (that's done by the implemented markdown function; try it in the comment pane of an item or in the chat - you'll get the same result). The app overview doesn't render markdown so it shows the correct number 30.

You can a) remove the dot or b) the blank space after the dot by the code   (non-breaking space) or c) you change month and day (januar 30.) - but I don't know if that works when you use it for outlook. 

a)
@Text.split("Hvonår: ").pop().split("\n").shift().replace(".", "")

b)
@Text.split("Hvonår: ").pop().split("\n").shift().replace(" ", " ") 

c)
var a = @Text.split("Hvonår: ").pop().split("\n").shift()
var a1 = a..split(" ");
var lastPart = a.replace(a1[0] + " " + a1[1], "");
var firstPart = a1[1] + " " a1[0];
firstPart + " " + lastPart

Rainer
 

Rainer Grabowski 1 vote
0
Avatar

Hey Rainer,

Thanks a lot again for helping me out!

I ended using @Text.split("Hvonår: ").pop().split("\n").shift().replace(".", "")

And it works perfect for now :)

- Malte

 

Malte Sandvej Thomsen 0 votes