Announcement

Collapse
No announcement yet.

Test Multi-Text Custom Field For Null

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Test Multi-Text Custom Field For Null

    I am trying to test a Multi-Text custom field to see if it is empty but it is failing.
    <mvt:if expr="NOT ISNULL trim(l.settings:product:customfield_values:customf ields:deckSpecAI)">
    <br><b>Additional Info:</b><br><ul>
    <mvt:assign name="g.string" value="l.settings:product:customfield_values:custo mfields:deckSpecAI" />
    <mvt:do file="g.Module_Library_Utilities" name="l.success" value="SplitString( g.string, ',', g.splitString )" />
    <mvt:foreach iterator="line" array="global:splitString">
    <li>&mvt:line;</li>
    </mvt:foreach>
    </ul>
    </mvt:if>

    If the field is empty it still prints the line Additional Info and the first bullet..
    Any help would be appreciated
    Thanks

    #2
    Are those spaces in the long field names typos in the message or are they in the code? That might have something to do with it if so.

    Since the code looks ok, the first thing I'd do is see if the string is really empty by doing something like:

    string: &mvte:product:customfield_values:customfields:deck SpecAI;

    or

    length: <mvt:eval expr="len(l.settings:product:customfield_values:cu stomfields:deckSpecAI)" />

    just to get an idea of where the problem might be.
    M.A.D.* since 1997

    http://www.scotsscripts.com

    *miva application developers

    Comment


      #3
      No I think it is now I copied it in. I changed the one line to this and it solved the problem. Thanks
      <mvt:if expr="NOT trim(l.settings:product:customfield_values:customf ields:deckSpecAI) EQ ''">

      Comment


        #4
        Cool. The "isnull" operator sometimes acts strangely. One of the things I do in some cases is check the length just to be sure a string is empty:

        <mvt:if expr="len(trim(l.settings:product:customfield_valu es:customf ields:deckSpecAI)) LE 0">
        M.A.D.* since 1997

        http://www.scotsscripts.com

        *miva application developers

        Comment

        Working...
        X