INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Expression gives different results on UI versus API  (Read 409 times)

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2407
Expression gives different results on UI versus API
« on: January 22, 2021, 03:26:35 am »

The API function GetFilledTemplate() seems to add an extra call to Clean() before returning the output. This causes the output to be different from expected, and different from what the same expression yields on MC's UI.

Examples:
file.GetFilledTemplate("test")      = "test"  (correct)
file.GetFilledTemplate(":test")     = ":test" (correct)
file.GetFilledTemplate(": test")    = "test"  (wrong)
file.GetFilledTemplate("test()")    = "test"  (wrong)


Simply outputting any field/value that contains () is also mangled:
Code: [Select]
save(/#test(), (), test2()#/, v_test)
[v_test]

This outputs "test, , test2" when using the API, and "test(), (), test2()" when using an Expression column on MC.

Can you please check and make the API return the same as the UI?
Thanks!

(PS: this issue was discussed here: https://yabb.jriver.com/interact/index.php/topic,125975.msg888913.html#msg888913)
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41976
  • Shoes gone again!
Re: Expression gives different results on UI versus API
« Reply #1 on: January 22, 2021, 08:00:35 am »

I just tried this URL:
http://localhost:52199/MCWS/v1/File/GetFilledTemplate?File=53728241&FileType=Key&Expression=%22:%20test%22

And I get:
<Response Status="OK">
<Item Name="Value">": test"</Item>
</Response>

Is this only the GetFilledTemplate(...) API function?

Thanks.
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41976
  • Shoes gone again!
Re: Expression gives different results on UI versus API
« Reply #2 on: January 22, 2021, 08:08:10 am »

You're right that API calls add this:
JRString::CleanFilledTemplate(strValue);

Not sure why.  Let me dig a while.
Logged
Matt Ashland, JRiver Media Center

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41976
  • Shoes gone again!
Re: Expression gives different results on UI versus API
« Reply #3 on: January 22, 2021, 08:17:51 am »

I'll remove it from the next build.  Here's the history:
Fixed: Getting an expression with the API could perform extra (and unwanted) cleaning of the output.

Thanks for helping find this!
Logged
Matt Ashland, JRiver Media Center

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2407
Re: Expression gives different results on UI versus API
« Reply #4 on: January 22, 2021, 10:49:43 am »

Thanks Matt! And props to Wer too, he bumped onto the issue on his first Zelda try :)
Logged
Pages: [1]   Go Up