Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Others by (2.6k points)

The following works as expected:

$values = @( ("x", "y"), ("k", "p") )
foreach($value in $values)
{
  write-host "Value 0 =" $value[0]
  write-host "Value 1 =" $value[1]
}

which results(1) in:

Value 0 = x
Value 1 = y
Value 0 = k
Value 1 = p

1 Answer

0 votes
by (7.2k points)
edited by

To solve this kind of error in TABLEAU you'll need to use the comma trick (the array operator) to get your  result:

$values = @( ,("x", "y") ) foreach($value in $values) { write-host "Value 0 =" $value[0] write-host "Value 1 =" $value[1] }

Result:

Value 0 = x Value 1 = y

Actually all you need is this:

$values = ,("x", "y")

Interested to learn about Tableau from top experts? Enroll in Tableau Course to get expert guidance.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Mar 21, 2021 in Java by Jake (7k points)
0 votes
2 answers
0 votes
1 answer

Browse Categories

...