Forum

Thread tagged as: Question

Working with Perch and RightMove .blm format feed

Has anyone used Perch to generate a RightMove .blm format feed? This is for an overseas property site where RM only accept .blm format.

For the uninitiated, .blm format is a text file with data values separated by | symbols. This also means that the correct number of values and blanks need to be generated. For example, the feed allows for 10 property features and whilst I can get these from Perch, there are problems generating the blank fields when the number of features is less than 10.

Any help appreciated. Thanks

Clive Walker

Clive Walker 22 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you show us your code?

Currently, I have this for my data-feed.html template. My main issue at the moment is generating the appropriate number of blank items for Features and Images (max 10 allowed in each case) when there are less than the max number.

<meta charset="utf-8">
<perch:before>#HEADER#
VERSION : 3i
EOF : '|'
EOR : '~'

#DEFINITION#
AGENT_REF|HOUSE_NAME_NUMBER|STREET_NAME|OS_TOWN_CITY|OS_REGION|
ZIPCODE|COUNTRY_CODE|FEATURE1|FEATURE2|FEATURE3|FEATURE4|FEATURE5|
FEATURE6|FEATURE7|FEATURE8|FEATURE9|FEATURE10|SUMMARY|DESCRIPTION|
CREATE_DATE|UPDATE_DATE|BRANCH_ID|STATUS_ID|BEDROOMS|PRICE|
PRICE_QUALIFIER|NEW_HOME_FLAG|PROP_SUB_ID|DISPLAY_ADDRESS|
PUBLISHED_FLAG|LET_DATE_AVAILABLE|LET_BOND|LET_TYPE_ID|LET_FURN_ID|
LET_RENT_FREQUENCY|TRANS_TYPE_ID|DEVELOPMENT_NAME|
MEDIA_IMAGE_00|MEDIA_IMAGE_01|MEDIA_IMAGE_02|MEDIA_IMAGE_03|
MEDIA_IMAGE_04|MEDIA_IMAGE_05|MEDIA_IMAGE_06|MEDIA_IMAGE_07|
MEDIA_IMAGE_08|MEDIA_IMAGE_09|MEDIA_VIRTUAL_TOUR_00|~
</perch:before>

#DATA#
<perch:content id="propertyid" />|<perch:content id="propertyname" type="text" /> |STREET_NAME |<perch:content id="town" type="text" />|<perch:content id="province" type="select" />|<perch:content id="country" type="select" />

<perch:if exists="featureslist">
    <perch:repeater id="featureslist">
    <perch:if exists="feature">|<perch:content id="feature" />
    <perch:if id="perch_item_index" match="lte" value="10"><perch:after>|</perch:after>
</perch:if></perch:if></perch:repeater><perch:else>|</perch:else>
</perch:if>

<perch:content id="description" type="textarea" editor="redactor" html="true" chars="197" append="..." />|<perch:content id="description" type="textarea" editor="redactor" html="true" label="Main Description" />|2008-03-16 21:29:36|2008-03-15 16:28:36|9054|STATUS_ID|<perch:content id="bedrooms" type="text" />|<perch:content id="price" type="text" />||||<perch:content id="propertyname" type="text" />, STREET_NAME, <perch:content id="town" type="text" />, <perch:content id="province" type="select" />, <perch:content id="country" type="select" />|PUBLISHED_FLAG||||||||

<perch:if exists="images">
    <perch:repeater id="images">
    <perch:if id="perch_item_index" match="lte" value="10">https://www.domain.com<perch:content id="image" type="image" />|</perch:if>
    </perch:repeater>
    <perch:else>|</perch:else>
</perch:if>||~

Drew McLellan

Drew McLellan 2638 points
Perch Support

The format of if/else is like this:

<perch:if>
    true
<perch:else />
    false
</perch:if>

There is no <perch:else>|</perch:else> syntax.

Oh, my mistake. I'll recode it and repost.

Have just been told that RightMove are developing an .xml feed to replace .blm format "in a few months" so this work is being put on hold for the moment. I may have to revisit it if the RM thing is delayed. Even with that and correct <perch:else /> syntax, I cannot see how to output the correct number of blank items though.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Because of the repeater?

Yes, I can see that

<perch:if>
value here| 
<perch:else />
|
</perch:if>

with, for example, 10 separate text or image fields, would give me what I want. Cannot see how to do it with repeater though.

Oh hang on a minute....

Revised code for the image section of my template:

<perch:if exists="images">
    <perch:repeater id="images">
    <perch:if id="perch_item_index" match="lte" value="10">|https://www.domain.com<perch:content id="image" type="image" /><perch:else />|</perch:if>
    </perch:repeater>
</perch:if>

So far, this seems to be working correctly (ahem). Is the above what you would do?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Sure, if it's working!

Have done some more testing. It works to the extent that there are images in the repeater (of course). What I mean is, if there are five images in the repeater, and I use

<perch:if id="perch_item_index" match="lte" value="2">

the output is two images and three | symbols.

What I need to do though is output 10 values in total. In the above case, this would mean two images and eight | symbols. Still thinking on that...

Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, that was my concern with the repeater - it will only output items that exist, not items that don't exist.