Need Help Getting Around an "/" in JSON that may not always be there

So, I have a customization that I am working on where I keep getting an error.

I have a Condition widget where the Expression is

'#_trans.dataView('T2DV').dataRow(0)['UD01_Key3']_#' = 'Entry'

As you can see, the left hand is dynamic and could contain any character. The error I am receiving is

function body ‘1/2’ = ‘Entry’ thrown exception SyntaxError: Invalid left-hand side in assignment

I am guessing it does not like the “/” in the value? Can anyone confirm that is the error?

If that is the error, is there a way to get around it?

Not 100% sure what you’re using this in but identifiers generally need to start with a letter or underscore and can only have letters, numbers, and underscores.

1 Like

Do you have to escape the internal apostrophes?

I don’t believe so, they are the ‘’ around the 1/2 value. If I don’t put them there, then the expression evaluates to

1/2 = ‘Entry’

1 Like

How about doubling the slash? If you’re sure it’s the slash.

'#_trans.dataView('T2DV').dataRow(0)['UD01_Key3']_#' = 'Entry'

This is resolving the value of
trans.dataView(‘T2DV’).dataRow(0)[‘UD01_Key3’] which maybe be ‘squirrel’ and trying to assign ‘Entry’ to a non variable this wont work

What you are saying in layman terms is

assign entry to the word squirrel

Not the variable holding the world squirrel but the word itself.

What are you trying to do?

4 Likes

I was trying to do a comparison. Adding in == made it work. Thanks @josecgomez

Batman Facepalm GIF by WE tv

4 Likes

Change your code to

'#_trans.dataView('T2DV').dataRow(0)['UD01_Key3']_#' == 'Entry'

EDIT:
Late to the party dammit @josecgomez

8 Likes

I’ve heard of the World Turtle but not the world squirrel.

Intrigued.

3 Likes

Listen I type with an accent too okay! :rofl:

world 
word 
drawer
yawn

are all super hard to pronounce when your genes are spanish speaking

6 Likes

Have you met me? I talk like I use a warsh wrag…

2 Likes

sort of like park and airport when your genes grew up near Boston

1 Like

pok and are pot

On the plus side y’all are born properly rolling your r’s. More than fair trade IMO.

2 Likes

hungry back and forth GIF

No, no, I think he’s on to something. Ratatoskr from Norse mythology is kind of a World Squirrel as he runs up and down the world tree, Yggdrasil.

1 Like

Don’t we all cobber?

2 Likes