Results 1 to 4 of 4
  1. #1
    Newbie
    Join Date
    March 8th, 2005
    Posts
    11
    Question little problem: happen only once?
    Hi all,

    Maybe someone can help me past this point with WM where I've got stuck:

    My WM-generated pages display index and detail pages for events.

    The index needs to have an 'optional' section on a sidebar for events that are sold out.

    The basic thing is easy enough - use a WM-If to pick out only those events with 'sold out' written in a field. If nothing is sold out at the moment, none will be displayed.

    However, I need a title at the top too! This should obviously not appear if nothing is sold out, but appear only once if more than one event is sold out.

    My thoughts led to:

    [WM-If: (CurrentRecordNumber = 1) AND (Field: Comments contains sold out)]
    SOLD OUT
    [/WM-If]

    However, I guess this wouldn't work unless record number 1 was one of the sold out ones.

    So is there any way to get WM to check through to see if any of the records fit a condition - if so, perform an action, but then stop?

    If not, I'll have to resort back to MS Access, where the data comes from!

    Thanks,

    Simon

  2. #2
    Newbie
    Join Date
    March 8th, 2005
    Posts
    11
    Another hour's work has been unfruitful in a different way.

    I went down the MS Access route, and built a query containing only the 'sold out' records I want - all good.

    But, if there aren't any sold out events at the moment, and therefore no records in WM's source file, it simply doesn't generate any html code.

    Let me show you what I tried:

    [WM-If: CurrentRecordCount > 0]
    Sold Out
    [/WM-If]

    [WM-Record]
    (details of each sold out event)
    [/WM-Record]

    Works fine with records, but not with nothing. No records -> no output is fine in theory, but a page update needs to overwrite an out of date html file with blank..

    help!

    I'm yearning for 'if CurrentRecordCount = 0, then STOP'...

  3. #3
    Affiliate Manager
    Join Date
    January 18th, 2005
    Location
    Los Angeles, California
    Posts
    1,913
    Quote Originally Posted by seastwood
    I'm yearning for 'if CurrentRecordCount = 0, then STOP'...
    That may not be hard to add, but I'm not sure I understand what's needed. Are you looking to prevent a page from being written if it has to relevant records associatied with your IF criteria, or to generate an empty page?
    Richard Gaskin
    Developer of WebMerge: Publish any data feed on any site
    http://www.fourthworld.com

  4. #4
    Newbie
    Join Date
    March 8th, 2005
    Posts
    11
    Dear Richard & all,

    Not to worry - I have found a workaround for my problem in the end.

    To summarise:

    I wanted WM to generate an HTML page even when there are no records in the source file. As it stands, WM doesn't do anything in that scenario, regardless of any HTML outside [WM-Record] [/WM-Record].

    My workaround is possible because the export from MS Access always contains the field names. So in WM, I turned off 'first line of file contains field names' so the first record will always appear as name: Field_001 data: Title [etc].

    A WM-If statement then controls the output so that the first record is not printed but any others are, while there's some code to output a 'none right now' message if recordcount is only 1 (ie, just the field names).


    btw, I'd be interested to see what anyone out there is doing with Webmerge that isn't just the affiliate datafeed style of project - I'm sure I can't be the only one!

    Simon

  5. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. Why does this happen?
    By mweidner2782 in forum Midnight Cafe'
    Replies: 0
    Last Post: February 19th, 2008, 08:09 PM
  2. why does this happen?
    By mweidner2782 in forum Search Engine Optimization
    Replies: 2
    Last Post: November 8th, 2007, 01:16 PM
  3. why does this happen?
    By mweidner2782 in forum Midnight Cafe'
    Replies: 1
    Last Post: November 8th, 2007, 01:11 PM
  4. Why Does This Happen?
    By Uncle Rico in forum Search Engine Optimization
    Replies: 0
    Last Post: August 31st, 2007, 06:50 PM
  5. Had to happen...
    By mousejockey in forum Search Engine Optimization
    Replies: 1
    Last Post: February 16th, 2002, 12:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •