Numeric & Text Functions in Knack
Updated: Sep 24, 2022
Questions about your Knack app? Let's Chat. https://www.knackbuilders.com. Knack has special functions used with either numeric equations or text formulas that do some pretty clever things. Extract just the city from an address field, generate a random number, find out the day of the week from a date field ... those sorts of things. Check it out, they are pretty simple to use.
Numeric Equation Functions: https://learn.knack.com/article/0xstljj9ta-numeric-equation-functions
Text Formula Functions: https://learn.knack.com/article/z2uiemxq8t-text-formula-functions
Get a free Knack trial account here: https://www.knack.com/r/you-tube
You can check out my Knack database services here: Knack!
Full Transcript
at knack
builders uh just gonna be a short video
but
uh today's topic is uh
using numeric and text functions
uh these are really cool i use them
regularly
and what they are
i'll show you this
i'll go through these in details but
they're special functions you can put in
either text equations or numeric
equations that do clever things
and they can be really helpful
so
i'll be right back and i'll take you
through how to use those thanks
[Music]
okay let's jump into this an american
text functions i did a couple videos one
on how to look at two dates
and extract how many work days they are
that uses one of these
and then i recently did one on how to
generate random numbers um
that's one of these two and
then i thought hey people should know
how to get these there's a whole bunch
of different ones that can be useful so
that's what this video is about i'll
leave these links or this link
in the uh
in the there's two links there's a knack
has a list of these different functions
one's for numerics
uh that's numbers equations
and the others for text formulas but
let's take a look at what they do um for
me the text formulas are a little more
interesting
uh but
this is the uh
numeric one
and they have all kinds of things in
here
cosine now if you're someone who needs
cosine last time i had to do sine or
cosine or things like that it was back
in a
you know college math class or something
and never ever needed it again but there
are people that use it and they have
some other these
now neck actually has
you know this in their fields you can do
things like min max average count
so that's a little redundant here but
they don't do medium you can probably i
don't think so but if they don't but
there's all kinds of different things
here's the random one sign
uh standard deviation these can all
be done here's that networking days
which counts working days but let's jump
over to the other one that i use more
often
are used to be used in text formulas
um
here's one
think of this as sort of extract
something from another field
uh i use this
not all that much but it's useful and
now i'm going to give you a use case
it extracts
to the left of some text field or to the
right of that text field a certain
amount of letters that you tell in this
case three
now here's a use case that i did we were
generating passwords for users creating
their accounts
and
we could just use something standard
like one two three four and then tell
them they can go in
and um
update the password after they log in
but we wanted to make a little more
professional and seem more secure so i
think i did something like extracted the
last three letters
of their last name
in the last three
numbers of their phone number now those
are two different fields but i got that
those uh that data and then i used
another text formula
to
uh combine those into one field and then
i forget how we did it with the password
we ran a task or a record rule or
something
that uh
set that value as the password so that
that was interesting
um
let me look at some other ones some of
these i don't use but
you turn something into all caps if that
was important
um let's keep going i don't know what
these rejects is
uh extracting date or address stuff
uh you can grab just the street from an
address
uh
you can grab just the city
you can grab this estate things like
that
that can be useful in a number of ways
same with names you can extract their
first name another use case too by the
way with this
uh
when you're when you're getting
to the left or to the right or something
you can i don't think mac in their name
thing says a standard thing where you
can just say hey give me the initials of
this person
so in this case you could do the first
letter of the first name
that'd be one field the first letter of
the last name be another
another field then you use a text field
to combine those two and then you would
have their initials
let's see what else we get
these get things are
are pretty cool
uh i think it's the date functions here
link
date functions you can get the
day of the week
or the month
from a date which can be useful too
um
in all kinds of ways but i'm not getting
the use cases in this case
i think what max says here
is it returns
like get day a week and will return
friday i don't think it does that what
it does is give you a number of the day
of the week
and and in this case the day of the week
starts on sunday
so if you get in one it's going to be a
sunday if you actually needed to have
fridays spelled out you'd probably have
to do a
do a multiple choice
or it could be a text but say a multiple
choice has the actual days of the week
monday tuesday wednesday whatever
then set a condition on that field that
says hey if this field that you just
made is number one set to sunday if it's
number two set to
monday that sort of thing uh there's
other things in here
as clever as you want you can get in
your uses of these
um now let me show you just briefly how
how would you use those
let's do this
let's do a text
text formula
it's just simple get right there get day
a week
and then you're gonna in the parentheses
put the date field that you want to get
it from the close the parenthesis and do
it that's the text field and that's just
pretty much the same thing for an
equation
let's just random right here
random is going to give you
um
that's the same thing you'll put random
in
you'll
here select
the number field that you or what you
want to get it from and then
or no here you'll put you're not drawing
off another field you're going to put
uh two numbers in there and the that's
what it'll generate one 100 will
generate a random number between those
so that's it folks uh
i hope this was just useful
appreciate it if you like this video you
know
do the click thing do the like thing
ring the bell
appreciate it take care