How to calculation 'Next Birthday' in a Podio field - podio

I want to be able to calculate the 'Next Birthday' date from a 'Date of Birth' field in Podio.
I cannot seem to get the calculation that makes this work.

Please try the below calculation
var dob = #DOB;
var nextDOB = moment(new Date(new Date(dob).setFullYear(new
Date().getFullYear() + 1))).format('DD/MM/YYYY');;
nextDOB+"";
Here, we are using the JS to get the next year date corresponding to the DOB field and parse it using moment js

It should be noted that this field will only calculate when the #DOB field is changed, so this will only work for the first 'next' birthday that comes up. I'd recommend using the API to set an actual date field instead of trying to use calculation fields for this.

Related

NetSuite Case statement works in Saved Search but doesn't work in Workflow

I have an issue with a formula case statement in a NetSuite workflow, I am using the same case statement in a saved search and it works just fine, but generates an error in the workflow formula for sourcing date, to set the date field on a cashsale record created from a sales order.
NetSuite formula which basically states if it is 10:00 PM (22:00) or after increment by one day, otherwise use datecreated date. (this is used to calculate settlement date for banking reconciliation matching)
The workflow event is "Before Record Load" on "Create" a Cashsale record which is definitely a server-side event. I have also independently pulled out
to_date({createdfrom.datecreated}) + 1
and
{createdfrom.datecreated}
Which work independently as expected without errors, really not sure what I am doing wrong
CASE WHEN to_number(to_char({createdfrom.datecreated}, 'HH24')) >= 22 THEN to_date({createdfrom.datecreated}) + 1 ELSE {createdfrom.datecreated} END
Here is the case statement I used in my saved search which works perfectly
CASE WHEN to_number(to_char({datecreated}, 'HH24')) >= 22 THEN to_char(({datecreated} + 1), 'DD/MM/YYYY') ELSE to_char(({datecreated}), 'DD/MM/YYYY') END
so basically in a before load create record user event use:
CASE WHEN to_number(to_char({sysdate}, 'HH24')) >= 22 THEN {sysdate} + 1 ELSE {sysdate} END
I see you have clarified your question.
{trandate} is a date field while the formula is producing a datetime field
So since your formula is meant to populate a date field you have to convert the datetime to a date:
TRUNC(CASE WHEN to_number(to_char({createdfrom.datecreated}, 'HH24')) >= 22 THEN {createdfrom.datecreated} + 1 ELSE {createdfrom.datecreated} END)
Unfortunately Netsuite Workflow formula value is not reliable in terms of using the Netsuite formulas that run in saved search. Some work and some don’t. In this case the To_char and date formatting seems to be not recognized at all.
Solution is a custom field named “Created Hours” that is dynamically sourcing value from a saved search. The field is exposed in Sales Order and Cash Sale transaction form (You can hide it as well). I then use the field as my comparison to achieve the condition that will set the date value. I tested few old Sales orders converting to Cash Sales and works well
Custom field hours
Hours saved search
Workflow to evaluate hours
Hope this helps other people with the same or similar issues.

I need to convert total date to month only

I set up a google forms form for my work where my employees pass information and this information is recorded in a spreadsheet. The information, when recorded, automatically inserts a date and time in the first column of form responses. However, when I enter the code = month (a1), it always returns the answer "1" or "January" and this information does not match the date entered in the column. How do I fix this?
If you are entering '=month(a1)' for every row, then you are always taking the month of the top left cell in the sheet. You would need to adjust the row number for the row you are in.
You could use something like '=month(now())' to ensure you are always getting the month of the current date.

Podio Age Calculation

My organisation has a Podio calculation field (see code below) to calculate the age of a person.
In order to get this field to update daily (because we need up to date data), the associated field #Date Today is updated with a Globiflow flow with today's date.
At the moment, there are ~1800 records and growing. So if this is run every day we are going way over the limits set by Globiflow (http://www.globiflow.com/help/globiflow-plans-and-limits.php).
Any ideas on more elegant ways to achieve this without using up our workflows? Essentially I need to calculate the age of each person, each day.
JS in Podio 'Age' field:
var date = #Date Of Birth;
var dateCalc = moment(date);
var currentDate = moment(#Date Today);
var calc = currentDate.diff(dateCalc, 'y','m');
date != null ? calc : null
Thanks
Shaun
One idea is to have an app with single item to keep the today's date. Update this single item everyday using GlobiFlow with today's date.
This item should be referred in all the 1800 Person items. Now use the today date from this single item in age calculation in person app. You can have a GlobiFlow to refer this single item automatically when ever a new Person is created.

Limiting data on monthly basis from start date to system date dynamically in Tibco spotfire

I've tried limiting data on monthly basis in spotfire and it's working fine.
Now I'm trying to do like getting the records from the current date to month start date.
For suppose if the current date is Sept 21, then i should get the records from Sept 21 to Sept-01(dynamically).
I have a property control to input the number of months.
The easiest way to do this is with Month and Year. For example, in your visualization:
Right Click > Properties > Data > Limit Data Using Expressions (Edit)
Then, use this expression:
Month([TheDate]) = Month(DateTimeNow()) and Year([TheDate]) = Year(DateTimeNow())
This will limit the data to only those rows with the current Year/Month combination in your data column. Just replace [TheDate] with whatever your date column name is.
In other places, you can wrap this in an IF statement if you'd like. It's redundant in this case, but sometimes helps with readability.
IF(Month([TheDate]) = Month(DateTimeNow()) and Year([TheDate]) = Year(DateTimeNow()),TRUE,FALSE)
#san - Adding to #scsimon answer. If you would like to precisely limit values between 1st of the current month to current date, you could add the below expression to 'Limit data using expression' section.
[Date]>=date(1&'-'&Month(DateTimeNow())&'-'&year(DateTimeNow())) and [Date]<=DateTimeNow()

AddDays is LINQ to SQL

I am trying to user the AddDays function in LINQ to SQL inside the Where clause.
I need to return all the results that are greater than the current date plus a user defined range.
Here is my code.
Where (DateTime.Now >= DateTime.Now.AddDays(UserEnteredDaysToAdd)
What am I doing wrong? or is it even possible?
Thank you,
Edit:
Sorry I made a mistake. I want to get all the records that are in between the current date and an number of days the user enters or is stored in the db.
So it should read, Where (StockOrderDate >= DateTime.Now.AddDays(UserEnteredDaysToAdd))
Lets have a look at your query:
Where (DateTime.Now >= DateTime.Now.AddDays(UserEnteredDaysToAdd))
Apart from not having the right body, you're checking if today is greater or equal to today plus x days. That won't ever be true if you do not allow negative values for UserEnteredDaysToAdd.
Your data structure (result) must have some date property you want to check for, like ResultDate, then your query would look like
IEnumerable<ResultType> results;
...
var resultsAfterDate = results.Where(r => r.ResultDate >= DateTime.Now.AddDays(UserEnteredDaysToAdd));