Problem:
I am using Peter Blum's Professional validation controls (http://www.peterblum.com/DES/MoreValidators.aspx) throughout my project and have come across a validation that should be done on the client side rather than going back to the server. The screen needs to send two dates(month/year) to the server, one for start date and one for end date. The dates are only month/year using Peter's MonthYearTextBox (http://www.peterblum.com/DES/DemoMoreDAT.aspx#MYTB). The two dates must not be more than 3 months apart (please note I did not say 90 days apart).
Here is the end goal:
A user comes to the screen to run a report. They are prompted for a start date (Month/Year) and an end date. These dates get sent to the server so that the report can be generated for the items within this date range. The user can only run this report for any 3 month period.
What I've Done:
I started off by using the DifferenceValidator from Peter's Validation And More package. In doing so, I set the difference that I expected to be 90 days, however soon realized that 7/2009 - 10/2009 is a 3 month difference (which is allowed) however it is a 92 day difference (which is outside the validator's range).
Question:
Is there any way that I can override the evaluation function in a client side function so that I may compare the month portion of the dates that are being evaluated?
Thank you,
Scott Blue
Yes there is. Here's a Javascript example:
function ValidateDateRange(cond)
{
var p = DES_GetById(cond.IDToEval).value; // Get the value of the control you're evaluating
if (p == undefined || p.length == 0) return 1;
// Perform custom validation here
// return 1 if valid, or return 0 if invalid
}
And you have to specify CustomEvalFunctionName="ValidateDateRange" in order for this to work.
I believe the CustomEvalFunctionName is supported in all of the different Peter Blum Validation controls.
Related
I have this handle bars statement in SendGrid. When using the variable taskCount the value is only used in the greaterThan block. The other 2 times it is used it appears to be null.
Here is the json data
{
"Username":"ChampCbg",
"JoinedAt":"12/1/2020",
"DaysSinceJoined":"20",
"taskCount":5
}
here is statement with handlebars
{{#greaterThan taskCount 0}}
Congrats on starting {{insert taskCount "default=1"}} task{{#greaterThan taskCount 1}} (s){{/greaterThan}} and taking the first small step.
{{else}}
You have not started a task yet. What are you waiting for? It has been {{DaysSinceJoined}} days since you joined on {{JoinedAt}}.
You have missed {{DaysSinceJoined}} days where you could been making Small Steps towards the dreams of you better tomorrow.
{{/greaterThan}}
Here is the end result
Hello ChampCbg!
Congrats on starting 1 task and taking the first small step.
Don't let another day pass you by. Start designing you vision board
today.
As the results show the greaterThan block selects the correct statement, but then next times taskCount is used the default value and null value are chosen.
What is the cause of this?
Twilio SendGrid developer evangelist here.
Honestly, I thought your template would work as you wrote it. But I tried it out and it did not (not that I didn't believe you, I just had to do that to work out what to do!).
So, the way to deal with this is to refer to the variables in your data using the #root object within the greaterThan conditional (or other conditionals).
Try this as your template:
{{#greaterThan taskCount 0}}
Congrats on starting {{insert #root.taskCount "default=1"}} task{{#greaterThan #root.taskCount 1}} (s){{/greaterThan}} and taking the first small step.
{{else}}
You have not started a task yet. What are you waiting for? It has been {{#root.DaysSinceJoined}} days since you joined on {{#root.JoinedAt}}.
You have missed {{#root.DaysSinceJoined}} days where you could been making Small Steps towards the dreams of you better tomorrow.
{{/greaterThan}}
Does anyone know how I should define a transit service that only occurs on public holidays, in GTFS?
calendar.txt as;
'4,0,0,0,0,0,0,0,20161211,20171209'
calendar_dates.txt as;
'4,20171001,1'
'4,20171002,1'
'4,20171225,1'
'4,20171226,1'
This apparently does not seem to work... My dataset also contains normal regular services, and they work fine.
Populate calendar_dates.txt exactly as you have shown above and put nothing in calendar.txt for service id 4
This is permitted by the spec, see
https://developers.google.com/transit/gtfs/reference/#calendar_datestxt
and I suspect that inserting an entry into calendar.txt with none of the days set to 1 is confusing validators.
You need to both add new service and cancel the service
In this case, New Year’s Day is added as a Sunday schedule (exception_type 1), with the existing weekday schedule cancelled out (exception_type 2).
In calendar.txt:
service_id,monday,tuesday,wednesday,thursday,friday,saturday,sunday,start_date,end_date
weekday,1,1,1,1,1,0,0,20140101,20240101
saturday,0,0,0,0,0,1,0,20140101,20240101
sunday,0,0,0,0,0,0,1,20140101,20240101
In calendar_dates.txt:
service_id,date,exception_type
weekday,20140101,2
Sunday,20140101,1
See my blog post : http://transitdata.net/on-calendars-and-calendar_dates/ for more info
I've been looking through Google App Script and having trouble finding info about the datetime object(?) they use. In my particular case, I'm trying to manipulate date-time values inputted by the user in a Google Spreadsheet. For example, we could return the time someone entered in cell B3 rounded to the nearest minute in a spreadsheet cell via some formula like =MROUND(B3,"00:01:00"). However, I don't know if there's an appropriate javascript/apps-script operation that does the same thing via the script editor?
I imagine maybe the trick involves finding some equivalent integer value to the datetime value (similar to the Date object in JS?) that we can then do a regular math operation on? Unfortunately, I only see the outputs in date-time format when I try to Logger.log the appropriate cell value(s)..
I think this does what you requested. Checkout Utilities.formatDate().
function NEARESTMINUTE(value)
{
if(time)
{
return Utilities.formatDate(new Date(value), Session.getScriptTimeZone(), "HH:mm:00")
}
else
{
return 'Invalid Inputs';
}
}
THE GOAL I WANT TO ACHEIVE:
Control AE timelines using ONE EXPRESSION LAYER (much like using Actionscript) to trigger frequently used comps such as blinking, walking, flying etc... for cartoon animation.
I want animate a the blinking of a cartoon character. (and other actions, explained below) Rather than "re posting" the comp or key frames movements every time I want a blink or a particular action, I want to create a script where I can trigger the Blink comp to play. Is this possible? (Sidenote: A random blink through entire movie would be nice) but I still want to know how to do this for the reasons below.
Ideally: I would like to create an "Expressions layer" in the main comp to TRIGGER other comps to play. At certain points I would like to add triggers to call frequently used comps that contain actions like.. Blinking, Walking, Flying, Look Left and Right etc...
IT WOULD BE AMAZING IF somehow we could trigger other comps to begin, repeat, stop, maybe reverse, and do this all from one Main Comp using an expression layer.
WHY DO IT THIS WAY?
Why not just paste a comp in the spot you want it to play every time you want such action? Well in after effects if you wanted a "blink comp" to play 40 times in two minutes you would have to create 40 layers, or pate the key frames on that comp 40 times. Wouldn't it be awesome to trigger or call it from one one layer when you wanted it from one expressions layer?
We do something like this in Flash using Actionscript all the time. It would be awesome if there was a method out there to achieve this effect. This would be an OUTSTANDING tutorial and I believe it would be very popular if someone did it. It could be used for a MULTITUDE of amazing effects and could save a ton of time for everyone. Heck, help me figure this out and perhaps I will make a tutorial.
Thank you all ye "overflowing Stackers" who contribute! :)
I found the answer and that is...
IT'S NOT POSSIBLE.
After Effects expressions can not control other timelines. Unfortunately you have to put an expression on each layer you want to affect.
The next best solution, and to achieve something close to what I was asking can be found on this link: motionscript.com/design-guide/marker-sync.html
We can only hope that Adobe will someday give the power to expressions like they did with action-script.
HOPEFULLY SOON! Anyone reading this who works for Adobe please plead our case. Thanks
Part 1: Reference other layers in pre-Comps
Simply replace "thisComp" with "comp("ComName")"
To reference Effect-Controllers between compositions, follow the below formula:
comp("ComName").layer("LayerWithExpression").effect("EffectControlerName")("EffectControllerType")
More In-depth Answer: Adobe's Docs - Skip to the Layer Sub-objects part
As I understand the Adobe documentation, only Layers can be accessed,
not footage. What this means is that you will need to create your
expression link utilizing a pre-Comp. Footage can not access this so
that also means no nulls, adjustment layers, etc.
As an added bonus, if you use the essential graphics panel, you can put all the controllers in one pre-comp, but have the controls available no matter which comp you are in. Just select it in the Essential-Graphics dropdown.
Part 2: Start/End based on other layers within pre-comps:
Regarding the next part where you want the expressions to activate based on other compositions, I recommend using the in-out Point expression.
inPoint | Return type: Number. Returns the In point of the layer, in seconds.
outPoint | Return type: Number. Returns the Out point of the layer, in seconds.
If you utilize the start time overrides you can pull this from:
startTime | Return type: Number. Returns the start time of the layer, in seconds.
Alternate Option:
I would recommend avoiding this as the keyframes are basically referenced as an index, so things can get messed up if you add one ahead of a keyframe you were already using - def incorporate some error handling.
Refer to the Key attributes and methods (expression reference) Here
Part 3: Interpolation & Time Reversal
You can time reverse the layer in the rightclick->time, otherwise this is all interpolation expressions like loop out etc - you can loopOut("FOO") a pre-comp if you not only cut it correctly, but also enable time remapping.
then use this to loop those keyframes;
try{ timeStart = thisProperty.key(1).time; duration = thisProperty.key(thisProperty.numKeys).time-timeStart; pingPong =
false; //change to true value if you want to loop animationn back &
forth quant=Math.floor((time-timeStart)/duration);
if(quant<0) quant = 0
if(quant%2 == 1 && pingPong == true){
t = 2*timeStart+ (quant+1)*duration - time;
}
else{
t = time-quant*duration;
}
}
catch(err){
t = time;
}
thisProperty.valueAtTime(t)
i am beginner dont know how do display all country time into a single page using action script 3 in flex . do u know any example time code refer me . i will try that code .
In Actionscript/Flex, you can only get either the local time, which is from the user's operating system, or the UTC time. You'll have to find a way of converting UTC to the user's time - or use externalInterface to communicate with something like java.
In Java you can use Calendar.getInstance(TimeZone zone) method to create a Calendar object of a timezone. TimeZone.getAvailableIDs() will give you list of inbuild timezones supported by Java. You can find out the timezones you want and using the id can create the TimeZone object from TimeZone.getTimeZone(String ID)