• Resolved l.kovich

    (@lkovich)


    Hello,
    I am managing auto dealer inventory and would like to filter cars by stock number, however some of the have the same/duplicate letters like: P405112, B8006P

    How do I filter it and display only cars with a stock number starts with a letter ‘P’?
    My shortcode is below:

    [IF({stocknumber[contains(.,’P’)]})]…[ELSE][ENDIF]

    Thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @lkovich

    You can use the “starts-with” function like so:

    [IF({stocknumber[starts-with(string(),"P")]})]Stock number: {stocknumber[1]}[ELSE][ENDIF]

    If you’re trying to do this in an XPath filter, it would look something like this:

    /node[stocknumber[starts-with(string(),"P")]]

    Thread Starter l.kovich

    (@lkovich)

    Worked perfectly. Thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘IF statement’ is closed to new replies.