Skip to Content Skip to Menu

Comparing 2 field values using substitution

  • softforge
  • softforge
  • OFFLINE
  • Posts: 129
  • Thanks: 21
  • Karma: 12
11 years 8 months ago #211432 by softforge
Hi, I want to check if one CB field is greater then another and display something based on that logic. I have tried the following but cannot get it to work:

[cb:if cb_weightnew < cb_weightold]Well Done[/cb:if]
[cb:if cb_weightnew < "cb_weightold"]Well Done[/cb:if]
[cb:if cb_weightnew < [cb_weightold]]Well Done[/cb:if]
[cb:if cb_weightnew < "[cb_weightold]"]Well Done[/cb:if]

Can this be done? So far I have only seen examples of fields being compared with manually entered strings. Surly there must be a way of comparing 2 CB fields, I just cant work it out.

Any suggestions?...

Many thanks :)

If you like our plugins, please consider writing a review on the Joomla Extension Directory or the Community Builder Directory ...

Please Log in or Create an account to join the conversation.

  • beat
  • beat
  • OFFLINE
  • Posts: 2166
  • Thanks: 462
  • Karma: 352
11 years 8 months ago #211447 by beat
Make sure that both fields are numeric for the "<" operator to work. If in HTML, you might have to html-specialchar it, e.g.:
[CODE]
< is &lt;
> is &gt;
[CODE]

This excellent tutorial of Kyle might help too:
www.allmysocials.com/directory/tutorials/item/233-substitution-usage

Beat - Community Builder Team Member

Before posting on forums: Read FAQ thoroughly -- Help us spend more time coding by helping others in this forum, many thanks :)
CB links: Our membership - CBSubs - Templates - Hosting - Forge - Send me a Private Message (PM) only for private/confidential info

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum