►
Description
Recurrent column and view formatting tip demo taken from the SharePoint dev Special Interest Group recording at 10th of January 2019. This time Chris shows how to use the @currentWeb and what's the benefits of this string function?
Presenter - Chris Kent (DMI) - @theChrisKent
More details on the SharePoint dev community calls from http://aka.ms/sppnp.
A
Okay,
alright,
everybody
I'm
Chris,
Kent,
I'm,
an
office,
development,
MVP
and
I.
Remember
the
core
team
and
again
I'm
going
to
show
you
another
exciting
list.
Formatting
quick
tip
all
right.
This,
this
tip
can
be
used
in
both
column,
formatting
and
view
formatting,
but
I'm
going
to
show
you
the
column
formatting.
However,
this
tip
is
going
to
be
in
office.
365
only
tip
it's
not
going
to
work
in
SharePoint,
2019,
on-premise,
okay.
A
So,
let's
take
a
look,
so
it's
pretty
common
that
you
want
to
reference
local
resources
within
your
format,
whether
that's
you
know
a
link
and
you're
trying
to
set
that
href
attribute
right
to
you
know,
link
to
either
a
list,
that's
on
the
site
or
specific
library
or
if
it's
an
image
right,
where
you're
trying
to
link
to
those
images
that
are
stored
directly
inside
a
document
library,
alright.
So
there's
two
options
in
the
past
and
these
are
the
only
two
options
are
available
to
SharePoint
2019.
You
can
do
a
hard-coded
URL,
plus
we're
gonna.
A
Put
that
whole
ten,
the
URL
and
you
put
it
all
the
way
to
your
sites
and
then
you're
gonna
build
the
link
that
way.
So
the
nice
thing
about
this
is
always
going
to
work.
Yeah
is
it
bad?
Is
bad
Jones,
bad
all
right,
but
it's
not
reusable
cross
site.
So
if
you
want
to
grab
that
format
right
and
some
of
these
formats
can
get
kind
of
complicated,
you
don't
want
to
be
going
back
and
manually
editing.
You
know
your
formulas
of
creating
these
links,
so
it's
just
not
reusable
and
again
hard-coded.
A
We
don't
want
that.
So
the
other
option
is
a
relative.
Url
is
we're
gonna,
do
like
a
dot
dot,
slash,
dot,
dot,
slash
I'll,
show
you
a
couple
examples
of
that
nice
thing
about
this:
it's
reusable
across
sites,
but
it's
super
dependent
on
the
relative
location
that
the
format
is
rendered,
which
sounds
a
little
weird.
I'll
show
you
what
I
mean,
but
it
makes
it
pretty
fragile.
So
what
do
you
do
instead
and
that's
what
I'm
gonna
show
you
it's
at
current
web?
This
is
a
brand
new
magic
string,
your
special
string
or
token.
A
A
So
if
we
go
to
our
standard
warrior
horses
site
here,
let's
say
I've
got
my
warrior:
horses
were
preparing
for
battle,
but
I'm
trying
to
organize
what
kind
of
horse
gear
do
we
have
fighting
our
battles
so
I've
got
this
nice
gear
list
over
here
right
now,
I've
got
my
gear
and
I
look
at
a
jet
bag.
I
got
orange
slices,
whatever
it
is,
and
I
want
to
rate
it
on
the
level
of
evilness
right
of
my
gear.
So
I've
got
that
here
and
then
I've
got
a
list
to
help
plan
things
right.
A
So
you
can
go
to
the
navigation,
but
this
is
boring.
So
let's
take
a
look
at
some
of
our
options,
so
the
first
one
is
a
link
right.
So
if
we
take
a
look
at
a
format
here-
and
these
are
samples
that
are
available
on
our
repo-
which
I'll
give
you
the
link
for
that
in
just
a
little
bit
here,
so
if
I
go
for
the
hard-coded
route
right.
A
So
if
you
take
a
look
at
this,
it's
pretty
simple:
it's
just
generating
the
link
all
right
and
I've,
setting
that
href
I'm
building
it
I'm
setting
it
to
whatever
the
current
field
is
so
the
name
of
that
list.
Alright,
but
I've
got
my
whole
ten
URL
in
here
and
that
works
right,
so
I'm
going
to
grab
that
and
I
copy
that
and
I
go
back
and
I'm
gonna
format.
A
This
thing
format
this
column
and
I
just
paste
it
in
there
all
right
if
I
preview
that
right
that
works,
so
I
can
actually
click
that
it
opens
up
there.
We
go
all
that
works,
that's
great,
but
if
I
try
and
use
that
anywhere
else,
we're
no
good
right.
So
the
other
option
is
I.
Do
a
relative
link?
Alright,
so
I
grab
this
thing
and
you
can
see
I've
got
dot,
dot,
slash
because
I
know
I'm
already
in
the
list
when
I'm
rendering
within
the
list
view
I
can
do
that
and
that'll
work
as
well.
A
So
I
come
back
in
here
and
grab
that
the
paste
that
well
preview,
then,
if
I
actually
take
a
look,
alright,
so
I
open
on
my
dev
tools
and
I
inspect
what
actually
got
generated
there
you'll
see
it's
literally
doing
the
dot
dot,
slash
just
relying
on
your
browser
to
understand
where
it
is
in
the
structure
of
the
site.
So
again
that
will
work.
So
if
I
click
these
things,
you
know
we
get,
though
the
link
it
opens
up,
just
fine.
So
if
you're
always
render
with
the
list
view,
that's
not
a
problem.
A
This
becomes
super
obvious.
However,
when
you
start
dealing
with
images.
So
if
we
take
a
look
at
images,
I'm
going
to
skip
over,
let
see
you
grab
the
right
thing
here.
So
if
we
go
to
our
images
or
it's
the
image
one
right
here
so
so
I've
got
a
hard-coded
image.
So
this
one
I've
got
my
evilness
right.
All
I
knew
times
of
setting
that
source
right
in
the
building,
a
PNG
based
on
that
choice
field,
just
because
I've
got
a
folder
in
my
shared
documents.
A
Library
again,
this
will
work
in
and
that'll
work
everywhere
and
I'll,
try
and
reuse
that
and
if
I
do
the
same
thing
with
a
relative
one
right,
we
could
see
this
so
I've
got
a
dot,
dot,
slash,
dot,
dot,
slash,
it
gets
a
little
complicated
trying
to
figure
out.
Where
are
we
relative?
You
know
to
the
folders,
but
I
can
grab
that
and
we'll
see
if
I
come
in
here
and
I'm
going
to
format
this
column
instead,
all
right.
So
let's
go
to
the
column,
settings
format.
A
This
column,
you
notice,
I've,
got
this
nice
new
option
here
for
choice,
columns,
I'm
going
to
said,
say:
Advanced
Mode
I
started
to
paste
a
format
directly
paste
that
in
and
preview
that
I'm
actually
save
that
alright.
So
now
I've
got.
You
know
these
evilness
scale
badges
very
exciting
as
your
this
thing.
But
if
I
come
over
here
to
a
regular
pair
or
a
nested
page
right,
that's
gonna
work
so
nest.
It
just
means
it's
at
the
same
level:
I
put
this
in
a
folder
all
right,
so
I've
got
a
little
folder.
A
If
we
can
see
it
here,
let's
even
zoom
in
there,
so
you
got
a
warrior.
Two
pages
I
paid
to
special,
so
I've
got
a
folder,
so
it's
at
the
same
level,
so
it
just
happens
to
kind
of
work
out
right
now.
What
about
a
regular
page
where
I've
got
this
on
here?
I
refresh
this
is
broken
I'm,
so
sad
right.
So
the
point
is
the
format
which
I
think
is
working
just
great
over
here,
actually
breaks
dependent
upon
where
it's
rendered.
We
don't
want
that.
A
That's
terrible
right,
so
we
could
go
to
the
hard-coded
route,
but
again
once
we
try
and
reuse
that,
maybe
we
use
that
as
part
of
our
provision
we're
trying
to
put
that
across
sites.
That's
gonna
require
a
manual
intervention
in
our
format
and
that's
terrible.
So
good
news.
We've
got
this
whole
other
thing
here
on
the
local
image
format.
We
can
use
this
token.
So
you'll
see
right
here
this
at
current
web.
A
So
if
I
just
build
it
with
that
so
I
say
at
current
web
and
then
I
provided
my
own
slash
again,
the
current
web
does
not
in
this
slash.
I
can
point
it
to
share
documents.
Evilness
I
build
that
string
the
exact
same
way,
but
I'm
no
longer
putting
my
tenets
in
I'm,
not
putting
my
very
specific
site
in
there,
so
that
guy
go
back
in
there
we
get
here.
We
go
go
back
to
our
gear
list.
All
right,
I've
still
got
this
open,
I'm
gonna
copy.
All
that
move
delete
it
paste.
A
A
So
the
point
is
use
that
current
web,
whenever
you
can
get
rid
of
all
of
your
relative
or
hard-coded
links,
whether
that's
your
links
or
your
image
sources,
anytime
you're,
trying
to
reference
something
on
the
site,
use
that
at
current
web,
that's
going
to
make
a
huge
difference
for
you
and
that's
the
whole
tip.
Oh
and
last
thing
here
is
here:
are
some
resources
for
you,
so
you
always
get
the
full
documentation.
A
There
is
an
update,
there's
a
pull
request
for
an
update
to
make
sure
that
current
web
is
documented
and
then,
of
course,
these
samples
are
out
there
and
here's
a
blog
post.
That
goes
in
a
little
more
detail
about
all
of
that
and
what's
available
with
the
current
web.
Ok
all
right!
Thanks
guys
catch
you
next
time.