Field Names with Space.

Field Names with Space.

kffoodskffoods Posts: 13Questions: 4Answers: 1

This:

Results in this:

But This:

Results in no sql error.....

but but result set field name has the brackets "[]":

and therefore:

Also If I add brackets around a field name that does have a space [Name]:

Results in double brackets "[[Name]]" and therefore:

How do I work with field names with Spaces. I notice there are none in the example. Is this because it's not supported?

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi @kffoods ,

    See this thread here, it says that spaces aren't supported unfortunately. I appreciate that thread is old, but I suspect (especially given your experiences) that this would still be the case.

    Cheers,

    Colin

  • allanallan Posts: 63,075Questions: 1Answers: 10,384 Site admin
    Answer ✓

    I've just replied to your other thread on this topic about table names in that case, but the same applies.

    Don't try quoting the fields yourself, that way lies madness at the moment!

    Allan

  • kffoodskffoods Posts: 13Questions: 4Answers: 1

    Ok... Getting better only problem now is the "->where". Without a where it works . with it gives:

    <br />
    <b>Notice</b>:  Undefined index: Customer No in <b>C:\inetpub\wwwroot\DataTables.Editor\KFF\php\editor.table.webuser.php</b> on line <b>42</b><br />
    {"data":[],"options":[],"files":[],"debug":[{"query":"SELECT  [Customer No] as 'Customer No', [User Code] as 'User Code', [Name] as 'Name', [Mapped Route No] as 'Mapped Route No', [Waste System] as 'Waste System', [Status] as 'Status', [Allow Menu Change] as 'Allow Menu Change', [Last Logon] as 'Last Logon', [Created On] as 'Created On', [Expires On] as 'Expires On', [Password] as 'Password', [Logon Count] as 'Logon Count', [Mobile Phone] as 'Mobile Phone', [Email] as 'Email' FROM  [Kitchen Fresh Foods$Web User] WHERE [Customer No] IS NULL ","bindings":[]}]}
    
    Editor::inst( $db, 'Kitchen Fresh Foods$Web User',array('Customer No', 'User Code') )
        ->fields(
            Field::inst( 'Customer No' ),       
            Field::inst( 'User Code' ),
            Field::inst( 'Name' ),
            Field::inst( 'Mapped Route No' ),
            Field::inst( 'Waste System' ),
            Field::inst( 'Status' ),
            Field::inst( 'Allow Menu Change' ),
            Field::inst( 'Last Logon' )
               ->getFormatter( Format::dateSqlToFormat( 'm/d/Y h:ia' ) ),
            Field::inst( 'Created On' )
               ->getFormatter( Format::dateSqlToFormat( 'm/d/Y' ) ),
            Field::inst( 'Expires On' )
                ->getFormatter( Format::dateSqlToFormat( 'm/d/Y' ) ),
            Field::inst( 'Password' ),
            Field::inst( 'Logon Count' ),
            Field::inst( 'Mobile Phone' ),
            Field::inst( 'Email' )
        )
        //->where( 'Customer No', $_GET["Customer No"] )
        ->debug( true ) 
        ->process( $_POST )
        ->json()
        ;
    
  • kffoodskffoods Posts: 13Questions: 4Answers: 1
    Answer ✓

    My Bad.... all good!

This discussion has been closed.