[Resolved] Using conditionals with negative numbers

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by bryant-3 4 years, 6 months ago.

Assigned support staff: Joanna.

Author
Posts
#331963

I am using a conditional to format a cell in a table by adding a class based upon this:

<td class ="game-spread[wpv-conditional if="( $(wpcf-spread) gte '6' )"] yellow[/wpv-conditional] cell-[types field="game-number"][/types]">[types field="spread"][/types]</td>

This works fine, I also need to add a conditional for a negative number like this:

<td class ="game-spread[wpv-conditional if="( $(wpcf-spread) lte '-6' )"] yellow[/wpv-conditional] cell-[types field="game-number"][/types]">[types field="spread"][/types]</td>

This does not work, any idea why?

#332150

Hello,

Could you please try to swap $(wpcf-spread) and '-6'? make sure that you have the right comparison operator after this change.

Please try this:

<td class ="game-spread[wpv-conditional if="( '-6' gte $(wpcf-spread) )"] yellow[/wpv-conditional] cell-[types field="game-number"][/types]">[types field="spread"][/types]</td>

Let me know if that worked.

#332260

That almost worked, I had to add an if statement in order to only apply it to cells that had content.

[wpv-conditional if="( NOT(empty($(wpcf-spread)))) AND ( '-6' gte $(wpcf-spread) )"] yellow[/wpv-conditional]

The forum ‘Types Community Support’ is closed to new topics and replies.