Hi,
I have 'Supplier' content type being added to my website which contains phone numbers. Using views export we pull a table of this data into Excel, however excel automatically removes the leading zeros from the phone numbers. It is not possible for us to change spreadsheet software or ask for any changes to made at 'this end'. We need Drupal to explode (but really split) the phone number field after the first 5 characters and insert a space here as this will cause Excel to recognise the string as text and not remove the leading zero.

I have created a triggered rule when new Supplier content is saved. All normal text fields are copied to new content using Rules bonus pack (awesome module) and the troublesome fields are individually copied using the "Populate a field" action, but I cannot work out the required PHP.

My variables are as follows;

$node - original added supplier node
field_supplier_landline - the field I would like to copy and explode

I know the php in the populate field will look something like...

return array(0 => array('value' => $node->field_supplier_landline[0]['value']));

but am unsure of how to add in the explode function...

Any help would be massively appreciated...

Cheers,
Reg.

Comments

TR’s picture

Issue summary: View changes
Status: Active » Closed (outdated)