I need to compare one specific vertex to all other and print if they have exactly the same outE("Pertinent", "Secondaire")
here is the request i made :
SELECT $b
let $a = (
SELECT *
FROM Regle
WHERE titre="1823 - accessoires poids lourds tachygraphe"
),
$b = (
SELECT *
FROM Regle
WHERE out("Pertinent", "Secondaire") = $a.out("Pertinent", "Secondaire")
)
Thanks in advance
You could use
SELECT expand($b)
let $a = (
SELECT *
FROM Regle
WHERE titre="1823 - accessoires poids lourds tachygraphe"
),
$b = (
SELECT *
FROM Regle
WHERE out("Pertinent").#rid in $a.out("Pertinent").#rid and out("Secondaire").#rid in $a.out("Secondaire").#rid
)
Hope it helps.
Related
I am using trying to populate a dropdown using magicVaueList hack and ExecuteSQl and I am having trouble with joining a text and number.
Here is my code:
MVL_Dropdown ( ExecuteSQL ( "select L.Product + GetAsText( L.Quantity )
from T08_ESTIMATES E
join T09_EST_LINE_ITEMS L on E.ID_Estimate = L.id_estimate
where E.ID_Estimate = ? "; ""; ""; T19_TASKS::preitem ) )
The trouble I get is with the + GetAsText( L.Quantity ) where I have also tried & GetAsText( L.Quantity ) will no results but if I was to remov ethe join like:
MVL_Dropdown ( ExecuteSQL ( "select L.Product
from T08_ESTIMATES E
join T09_EST_LINE_ITEMS L on E.ID_Estimate = L.id_estimate
where E.ID_Estimate = ? "; ""; ""; T19_TASKS::preitem ) )
Then it works minus the fact that I will need both values. I'm therefore certain the problem exists Concatenating my text and number but I'm quite new to FileMaker and not sure what to use to get it to work.
.
Any help appreciated.
For anyone wondering i had to use a double pipe like so:
L.Product || ' - ' || L.Quantity
MVL_Dropdown ( ExecuteSQL ( "SELECT L.Product || ' - ' || L.Quantity || ' off'
FROM T08_ESTIMATES E
JOIN T09_EST_LINE_ITEMS L ON E.ID_Estimate = L.id_estimate
WHERE E.ID_Estimate = ? "; ""; ""; T19_TASKS::preitem ) )
STRVAL - Converts a value of any type to a character string
Here I wanted to concatenate an integer "Quantity" and string "Units":
ExecuteSQL ( "
SELECT p.Description, STRVAL ( m.Quantity ) || p.Units
FROM JobMaterials m
JOIN Products p
ON m.kf_Product = p.kp_ProductID
WHERE m.kf_JobID = ?
" ;
"¦" ; "¶" ;
Jobs::kp_JobID
)
This is my schema:
My objective is capture that purple Vertex with name "Paragrafo" and have connection with the Vertex "1" AND "2", in this case will be the #29:426.
I tried:
SELECT EXPAND( BOTH( 'Contem' ) ) FROM Topico WHERE Assunto = '1' and Assunto = '2'
or
SELECT * FROM Topico WHERE Assunto = '1' and Assunto = '2'
or
SELECT FROM ( SELECT EXPAND(BOTHE('Contem')) FROM Topico WHERE Assunto='2' and Assunto = '1')
The AND operator make the query return None.
It's possible to make a query to do that?
I'm doing my schema right?
Thanks.
Try this:
select from Topico where out().<property_name> contains '1' AND out().<property_name> contains '2'
Hope it helps
Regards
I am want to use OR EXISTS clause in QueryBuildDataSource but i dont know how to use it.
I prepare sql query:
select * from LedgerJournalTable l
where
(
l.createdBy = '...' and l.WorkflowStatus != 99
)
or exists
(
select top 1 'x' from WorkflowWorkItemTable w
where l.RecId = w.RefRecId
AND w.REFTABLEID = 211
and w.USERID = '....'
)
and i try to build ax query
queryDS = LedgerJournalTable_ds.query().dataSourceTable(tableNum(LedgerJournalTable));
ledgerStatusFilter = queryDS.addRange( fieldnum(LedgerJournalTable,WorkflowStatus) );
ledgerUserFilter = queryDS.addRange( fieldnum(LedgerJournalTable,createdBy) );
ledgerStatusFilter.value( "!=99" );
ledgerUserFilter.value( "..." );
qbdsWorkItemtTable = queryDS.addDataSource( tablenum(WorkflowWorkItemTable) );
qbdsWorkItemtTable.joinMode( JoinMode::NoExistsJoin );
qbdsWorkItemtTable.addLink( fieldnum(LedgerJournalTable,RecId), fieldnum(WorkflowWorkItemTable,RefRecId) );
qbdsWorkItemtTable.addRange( fieldnum(WorkflowWorkItemTable,RefTableId) ).value( strfmt("%1",tablenum(LedgerJournalTable)));
workflowUser = qbdsWorkItemtTable.addRange( fieldnum( WorkflowWorkItemTable, UserId ) );
workflowUser.value("...");
info( strfmt("%1", queryDS.toString() ) );
sory for my bad English :c
Sorry, but AX queries do not support or exists.
Also see this similar question.
Im executing this query:
$query = "
Select * From table1 Where id = 1;
Select * From table2 Where name = 'test';
";
With \Zend\Db\Adapter\Adapter:
$stmt = $this->dbAdapter->query($query);
$rawResult = $stmt->execute();
How can I access the second result?
$rawResult->next() only returns values from first query.
Use two different queries.
/*
* First Query
*/
$query = "
Select * From table1 Where id = 1
";
$stmt = $this->dbAdapter->query($query);
$rawResult = $stmt->execute();
/*
* Second Query
*/
$query = "
Select * From table2 Where name = 'test'
";
$stmt = $this->dbAdapter->query($query);
$rawResult = $stmt->execute();
I don't believe it works the way you had it to where two queries in a row are sent this way.
To avoid code duplication you can wrap the duplicated code into a method.
$rawResult1 = $this->getResults("Select * From table1 Where id = 1");
$rawResult2 = $this->getResults("Select * From table2 Where name = 'test'");
function getResults(string $query)
{
$stmt = $this->dbAdapter->query($query);
return $stmt->execute();
}
I have this template for my database:
I want to do a query that return all the "Ontologie" linked to one specific "Rubrique".
It can take all the edge except "Facultatif".
I actually have this query that return all the "Ontologie" but it doesn't pass by "Regle" so i don't have every "Ontologie"
SELECT *
FROM (
SELECT expand(in('Synonyme').in('Identifie').in('Regroupe'))
FROM Rubrique
WHERE libelle = "collèges, lycées avec internat"
)
Thanks.
You could use
select expand($c)
let $a = ( SELECT * FROM (
SELECT expand(in().in('Identifie').in('Regroupe'))
FROM Rubrique
WHERE libelle="collèges, lycées avec internat"
)),
$b = ( SELECT * FROM (
SELECT expand(in('Pertinent').out('Obligatoire'))
FROM Rubrique
WHERE libelle="collèges, lycées avec internat"
)),
$c=unionAll($a,$b)
Hope it helps