How to join on computed fields

How to join on computed fields

LapointeLapointe Posts: 430Questions: 81Answers: 4

Hi all

I have GPS coordinates in 2 tables (from and to) and a ref table (range)...

table from

Lon   
Lat

table to

Lon   
Lat

table range

Min
Max
Message

The record in table to is correctly selected (linked by another join)
I'd like to set lunction as

Editor::inst( $db, 'from' )
    ->leftJoin( 'range', GetGap(from.lon,from.lat, to.lon, to.lat), 'BETWEEN','range.Min, range.Max' )

GetGap function exist using JS or PHP ...

I have a look to

Field::inst( 'status' )
    ->getFormatter( function ( $val, $data ) {
                return $val ?
                    ? 'Done'
                    : 'To Do';
    } )
// bug in the sample (return $val ? ? 'Done') page "https://editor.datatables.net/manual/php/formatters"

but have no field into table from to link editor with

Does somebody know how to ?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    Currently there is no way to do that with the Editor PHP libraries I'm sorry to say. It only handles simple join conditions.

    Are the moment you'd need to use a VIEW and then read from that.

    Regards,
    Allan

  • LapointeLapointe Posts: 430Questions: 81Answers: 4

    Hi @allan

    You say 'currently'.... Your product is actually fantastic and everyday you make it better... Thank.

    I solve problem using a sql upload for range data and set it in a js array before use it in calculation, and get gps coordinates into (data)table for table from and to
    B)
    Regards
    Bobby

This discussion has been closed.