Can you help me with a workflow?
I'm pulling a project based on a name search from a form (the names are unique in the database). However, I need to grab the project ID from that datastore, set it to a variable, and use it in several other queries. For example:
- First Query finds the project and returns the name and id:
$this->src('teamKRS')
->query(MySQL::type(
DB::table("projects")
->where([
['projects.name',$storeName],
['projects.in_trash',NULL]
])
->Select('projects.name')->alias('Project')
->AddSelect('projects.id')->alias('ID')
->take(1)
))
->pipe($this->dataStore("client_project_header"));
- The next query requires the project id to work correctly, however:
$this->src('teamKRS')
->query(MySQL::type(
DB::table("extra_fields_list")->where([
['extra_fields_list.bind_id', $projID],
['extra_fields_list.extra_fields_id', '12'],
])
->Select('extra_fields_list.value')->alias('Address')
))
->pipe($this->dataStore("client_address"));
All of these are combined into a single report.
How can I use projects.id from dataStore("client_project_header") to set $projID before running the next query?
Thanks,
Rooze