DMXzone Server Data Formatter Support Product Page

Value based on comparison of 2 strings

8 years ago Bobby Edgar posted:
I have an upload form that then loads the image and gives me the width and height of the image and places it into the DB, no problem.

I want to compare the width and height and input a field value of portrait or landscape depending on if the width is greater than the height.

If tried several methods, but nothing seems to work.

Example:

{{portrait.where("load_image.width", "<", "load_image.height")}} OR {{landscape.where("load_image.width", ">", "load_image.height")}}



Any Ideas?

Replies

Replied 8 years ago
8 years ago Teodor Kuduschiev replied:
Hello Bobby,
Just use the condition step in server connect. Use the {{load_image.width < load_image.height}} as a condition and add the insert step inside it, in the then clause, inserting "portrait". In else add another insert step, which inserts "landscape".

Reply to this topic