Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version next

...

D s
snippetBasic

URL literal examples:

DOMAIN
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
domain('http://www.example.com' ) as: 'myDomain'

domain('http://www.example.com')


Output:
Generates a column containing Returns the value example

DOMAIN
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
domain('http://www.exampl.e.com' ) as: 'myDomain'

...

domain('http://www.exampl.e.com')

Output: Returns the value e

Column reference example:

DOMAIN
d-codelang-syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:
domain(myURLs) as: 'myDomain'

domain(myURLs)

Output: Generates the new myDomain column containing the domain  Returns the domain values extracted from the myURLs column. 

D s
snippetSyntax

DOMAIN
d-codelang-syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:
domain(column_url)

domain(column_url)


ArgumentRequired?Data TypeDescription
column_urlYstringName of column or String or URL literal containing the domain value to extract

...

NameReferrer
Joe Guyhttp://www.example.com
Ian Holmeshttp://www.test-value.com/support
Nick Knight http://www.test-value.com
Axel Adams http://www.example.com
Teri Towns http://www.example.com/test-value

TransformTransformation:

The referrrer values include test-value as a non-domain value and varying URLs from the test-value.com domain. So, you should use the DOMAIN function to parse only the domain versions of these values. The following evaluates the Referrer column values for the test-value domain and generates true/false answers in a new column accordingly:

d-

...

trans
RawWrangletrue
p03Value'isInternal'
Typestep
WrangleTextderive type:single value:

...

if(

...

domain(Referrer)=='test-value',true,false) as:'isInternal'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueif(domain(Referrer)=='test-value',true,false)
p03NameNew column name
SearchTermNew formula

Now that these values are flagged, you can filter out the internal names:

d-

...

trans
RawWrangletrue
p03Value(isInternal == 'true')
Typestep
WrangleTextdelete row:(isInternal == 'true')
p01NameCondition
p01ValueCustom formula
p02NameType of formula
p02ValueCustom single
p03NameCondition
p04ValueDelete matching rows
p04NameAction
SearchTermFilter rows

Results:

NameReferrerisInternal
Joe Guyhttp://www.example.comfalse
Axel Adamshttp://www.example.comfalse
Teri Townshttp://www.example.com/test-valuefalse

...