This topic is locked

It inserts correct data into Mysql

3/24/2011 5:24:49 AM
PHPRunner General questions
S
swanside author

Hi there.

My job table consists of the following

-- Table structure for table `job`

--
CREATE TABLE IF NOT EXISTS `job` (

`Order_Date` datetime DEFAULT NULL,

`AttendBy` date DEFAULT NULL,

`End_Date` date DEFAULT NULL,

`File_No` varchar(50) DEFAULT NULL,

`Job_No` int(50) NOT NULL AUTO_INCREMENT,

`CustomerId` int(255) DEFAULT NULL,

`Order_Time` varchar(50) DEFAULT NULL,

`Contract` longtext,

`Order_Site_Address` varchar(200) DEFAULT NULL,

`Job_Description` longtext,

`VAT` decimal(7,2) DEFAULT NULL,

`Invoice_Printed` tinyint(1) DEFAULT NULL,

`Invoice_Printing_Date` date DEFAULT NULL,

`Invoice_Tax_Date` date DEFAULT NULL,

`Payment_Received` tinyint(1) DEFAULT NULL,

`Job_Finished` tinyint(1) DEFAULT NULL,

`CustomerRef` varchar(50) DEFAULT NULL,

`Customer_Name` varchar(50) DEFAULT NULL,

`Payment_Due_date` date DEFAULT NULL,

`Payment_Date` date DEFAULT NULL,

`Note` longtext,

`Date_Added` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

`EngineerId` varchar(50) NOT NULL,

`PDAAllocation` varchar(100) DEFAULT NULL,

`LocationId` varchar(255) DEFAULT NULL,

`JobTypeId` varchar(50) NOT NULL,

`Job_Sheet` varchar(50) DEFAULT NULL,

`Post_Code` varchar(200) DEFAULT NULL,

`Line1` varchar(200) DEFAULT NULL,

`DoorCode` varchar(200) DEFAULT NULL,

`GateCode` varchar(200) DEFAULT NULL,

`AlarmCode` varchar(200) DEFAULT NULL,

`ExtraCodes` varchar(200) DEFAULT NULL,

`Exported` tinyint(1) DEFAULT NULL,

`Logged_By` varchar(200) DEFAULT NULL,

`PhoneNumber` varchar(20) DEFAULT NULL,

`CRB_No` varchar(50) DEFAULT NULL,

`CustomerEmail` varchar(200) DEFAULT NULL,

`Engineer_Note` longtext,

`ResponseCatagories` tinyint(1) DEFAULT NULL,

`CallerName` varchar(50) DEFAULT NULL,

PRIMARY KEY (`Job_No`),

UNIQUE KEY `File_No` (`File_No`),

KEY `Order_Site_Address` (`Order_Site_Address`)

) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1027881 ;


When we add a new job, we first select the customer by using the lookup wizard on the CustomerId and use this as in the picture.


This is fine, and in the database it inserts this value

-- phpMyAdmin SQL Dump

-- version 3.2.5

-- http://www.phpmyadmin.net

--

-- Host: localhost

-- Generation Time: Mar 24, 2011 at 09:09 AM

-- Server version: 5.1.34

-- PHP Version: 5.2.9-2
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
/!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /;

/!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /;

/!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /;

/!40101 SET NAMES utf8 /;
--

-- Database: update

--
--

-- Dumping data for table job

--
INSERT INTO job (Order_Date, AttendBy, End_Date, File_No, Job_No, CustomerId, Order_Time, Contract, Order_Site_Address, Job_Description, VAT, Invoice_Printed, Invoice_Printing_Date, Invoice_Tax_Date, Payment_Received, Job_Finished, CustomerRef, Customer_Name, Payment_Due_date, Payment_Date, Note, Date_Added, EngineerId, PDAAllocation, LocationId, JobTypeId,Job_Sheet, Post_Code, Line1, DoorCode, GateCode, AlarmCode, ExtraCodes, Exported, Logged_By, PhoneNumber, CRB_No, CustomerEmail, Engineer_Note, ResponseCatagories, CallerName) VALUES

('2011-03-24 00:00:00', NULL, NULL, 'TM0858', 1027881, 1198, NULL, '', NULL, '', 3.00, NULL, NULL, NULL, NULL, NULL, '', NULL, NULL, NULL, NULL, '2011-03-24 08:58:28', '6', NULL, '235', '15', NULL, 'L25 2PY', 'CHILDWALL VALLEY RD', '', '', '', '', NULL, NULL, '', '001180126849', 'test@test.com', NULL, NULL, '');
But when I export it using PHPRunner I choose these fields


But, Instead of exporting the CustomerId which is in the database, It exports it as the CustomerName as in this case, All the key fields to this project exporting correctly are in bold font
<?xml version="1.0" encoding="Windows-1252" standalone="yes" ?>

  • <table>
  • <row>

    <OrderDate>2011-03-24 00:00:00</OrderDate>

    <FileNo>TM0858</FileNo>

    <JobNo>1027881</JobNo>

    <CustomerId>MERSEYSIDE FIRE</CustomerId>

    <Contract />

    <JobDescription />

    <CustomerRef />

    <EngineerId>PAUL GRIMES</EngineerId>

    <LocationId>BELLE VALE FIRE STATION</LocationId>

    <JobTypeId>AHU Service</JobTypeId>


    <PostCode>L25 2PY</PostCode>

    <Line1>CHILDWALL VALLEY RD</Line1>

    <DoorCode />

    <GateCode />

    <AlarmCode />

    <ExtraCodes />

    <PhoneNumber />

    <CRBNo>001180126849</CRBNo>

    <CustomerEmail>test@test.com</CustomerEmail>

    </row>

    </table>
    So the following fields should display the Id Numbers
    <?xml version="1.0" encoding="Windows-1252" standalone="yes" ?>
  • <table>
  • <row>

    <OrderDate>2011-03-24 00:00:00</OrderDate>

    <FileNo>TM0858</FileNo>

    <JobNo>1027881</JobNo>

    <CustomerId>1198</CustomerId>

    <Contract />

    <JobDescription />

    <CustomerRef />

    <EngineerId>6</EngineerId>

    <LocationId>235</LocationId>

    <JobTypeId>15</JobTypeId>

    <PostCode>L25 2PY</PostCode>

    <Line1>CHILDWALL VALLEY RD</Line1>

    <DoorCode />

    <GateCode />

    <AlarmCode />

    <ExtraCodes />

    <PhoneNumber />

    <CRBNo>001180126849</CRBNo>

    <CustomerEmail>test@test.com</CustomerEmail>

    </row>

    </table>
    My Question is?
    How can I get it to display the customers Name when we add using the lookup wizard, and the CustomerId as the link, but to export the CustomerId and not the Custoner Name?
    Cheers

    Paul.

J
Jane 3/24/2011

Hi,
to export actual values create alias for this field on the Edit SQL query tab:

select ...

CustomerId,

CustomerId as CustomerId_export,

...

from `job`



Then add CustomerId_export field to the exprot page only on the Choose fields tab and set up this field as text on the"Edit as" settings dialog on the Visual Editor tab.