Prachya Posted September 5, 2024 Posted September 5, 2024 How can we change start date format of each capsule to MMM-YY format. or need to define as new property?
Seeq Team John Cox Posted September 9, 2024 Seeq Team Posted September 9, 2024 Hello Prachya, To do this you will need to 1) create a new signal whose value represents the reformatted 'Start' time of your condition and 2) then add a new property to your condition using the signal created in step 1: Here is the formula for 1) Signal with Reformatted Start Time: // This formula creates a signal whose value represents the start time // of the condition of interest ($ExistingCondition), reformatted as MMM-DD // change the 10d below to be a bit longer than the maximum duration of capsules in $ExistingCondition $ExistingCondition.removeLongerThan(10d) // Next line is optional as needed to correct // for time zone (in this example I'm correcting to US/Eastern Time) // This may be needed because .toSignal('Start') will give the Start time // in UTC .move(-4hr) // convert 'Start' property to a string signal .toSignal('Start') .toString() // Extract out only the month and day from the 'Start' property .replace('/(?<year>....)-(?<month>..)-(?<day>..)T(?<hour>..):(?<minute>..):(?<sec>..)(?<dec>.*)Z/' , '${month}-${day}') // now, replace the month number with MMM .replace('01-','JAN-') .replace('02-','FEB-') .replace('03-','MAR-') .replace('04-','APR-') .replace('05-','MAY-') .replace('06-','JUN-') .replace('07-','JUL-') .replace('09-','AUG-') .replace('09-','SEP-') .replace('10-','OCT-') .replace('11-','NOV-') .replace('12-','DEC-') // Only need next line if making a time zone correction above. // The 20d should be changed to be a bit longer than the // maximum time BETWEEN capsules in $ExistingCondition. .validValues().setMaxInterpolation(20d) Here is the formula for 2) Condition with a new "Reformatted Start" property defined. The formula uses the signal created in step 1) above: // change the 10d below to be a bit longer than the maximum duration of capsules in $ExistingCondition $ExistingCondition.removeLongerThan(10d) .setProperty('Start Reformatted',$ReformattedStartSignal,startValue())
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now