List of options in "args" array used to build Enterprise Manage Screens
1)Pagesize
Syntax
[pagesize]20[/pagesize]
- This is required parameter
- This parameter is used for to specify no. of rows per page
- If the value of pagesize is -1 then query will return all posts
2)Page No.
Syntax
[pageno]2[/pageno]
- This is optional parameter
- This parameter is used to get particular page no. data
3)Offset
Syntax
[offset]20[/offset]
- This is optional parameter
- This parameter is used to give offset value
4)with
Syntax
[with][/with]
To set with query this parameter is used
Parameters of [with]
- [sql]
- [published_posts]
- [aw2_filter_query]
- [add_field]
- [filter]
this parameters explained below:
4.1) [sql]
- This is a plan sql query
- This query basically selects all data ids which data we want
- Example:
-
1SELECT object_id as data_id FROM job_postings where coll_id='company’ and meta_key='company_id'
- This query will return all object_id from job_postings table
4.2) [published_posts]
- This array has only one parameter post_type
- By using this parameter you can select published posts from wp_posts table where post_type is post_type
4.3) [add_field]
Parameters:
- meta_key
- aw2_meta_key
- taxonomy
- sql
- You can pass custom sql by using this parameter
- Id_field (default : post_id)
- ref_id (default : data_id)
- meta_value_field (default : meta_value)
- If you want to give custom meta_value column name then specify the name of that column by using this field.
- field (default = {template.meta_key})
- table (default : wp_postmeta)
- Database table on which you want to perform operation
- meta_key_field (default : meta_key)
- If you want to give custom meta_key column name then specify the name of that column by using this field.
- ifnull
- coll_id
- Value of the coll_id field
- This field is optional
Difference between meta_key and aw2_meta_key for add_field parameter:
meta_key | aw2_meta_key |
You can’t pass coll_id | You can pass coll_id as optional parameter |
Default values for following parameters
|
Default values for following parameters
|
Examples:
[add_field new table=candidate_meta meta_key_field=’custom_meta_key’ meta_value_field=’custom_meta_value’ aw2_meta_key=’created_date’/] |
Examples:
[add_field new table=candidate_meta aw2_meta_key=’created_date’ coll_id=’candidate’ /] |
4.4) [filter]
Parameters:
4.4.1) sql
- To add custom sql filter query this parameter is used
4.4.2) meta_table
Required parameters:
- coll_id : coll_id name
- table : database table name
- meta_key: comma separated meta keys
- meta_value: meta value
Optional Parameters:
- id_field (default: object_id)
- ref_id (default: data_id)
- meta_key_field (default: meta_key)
- meta_value_field (default: meta_value)
- operator (default: in)
- data_type (default: string)
By using this parameter in filter array you need to provide coll_id
And hence this parameter has limitation means coll_id should be same
4.4.3) meta_key
Optional Parameters:
- table (default: wp_postmeta)
- id_field (default: post_id)
- ref_id (default: data_id)
- meta_key_field (default: meta_key)
- meta_value_field (default: meta_value)
- Required Parameters:
- meta_key: comma separated meta keys
- meta_value : meta value
- operator: (default : in)
- data_type: (default: string)
4.4.4) filter_period
Required parameters:
- field: meta key name on which filter operation will perform
Optional parameters:
- period (default: day:today)
Example:
1 |
[filter new field='created_date' period='{form_data.after_date}' not_empty="{form_data.after_date}" /] |
On above example period filter is added on created_date
4.4.5) after_date,before_date,from_date,to_date
Required parameters:
- field: meta key name on which filter operation will perform
- This field is considered as date field.
- after_date : to get posts which created after given date
- before_date : to get posts which created before given date
- from_date : to get posts which created from given date
- to_date : to get posts which created upto given date
4.4.6) field
To filter on column name and column value use this parameter
Optional Parameters:
- table (default: wp_posts)
- id_field (default: ID)
- ref_id (default: data_id)
- operator: (default : in)
- data_type: (default: string)
Required Parameters:
- field: column name eg: object_id,meta_value
- field_value : column value
4.4.7) id_field
Optional parameters:
- table (default: wp_posts)
- id_field (default: id_field)
- ref_id (default: data_id)
5) [atts query_count=yes /]
If query_count is set to yes then query will return count of total posts
6) [meta]
This parameter is used to get meta values.
Parameters:
- bounded_field
- this is used to get column value (columns can be stamp, updated by, object_id, coll_type etc)
- eg.
12[meta new bounded_field='learner_id' /][meta new bounded_field='order_id' /]
here learner_id and order_id are column and not meta_key
- x
- field
- meta_keys
- taxonomy
- sql
- aw2_collection_keys
6.1) meta_keys
Optional Parameters:
- data_id_field (default=data_id)
- meta_key_field (default=meta_key)
- meta_value_field (default=meta_value)
- table (default=wp_postmeta)
- id_field (default=post_id)
- ref_id (default=data_id)
Meta Key Example 1:
1 2 3 4 5 |
[meta new] [table]candidate_meta[/table] [meta_keys]first_name,last_name,email[/meta_keys] [id_field]object_id[/id_field] [/meta] |
Meta Key Example 2:
1 2 3 4 5 6 |
[meta new] [table]job_postings[/table] [meta_keys]job_id,title,min_experience[/meta_keys] [coll_type]job[/coll_type] [id_field]coll_id[/id_field] [/meta] |
Important variables:
- ref_id
- ref_id is the data_id of previous query data
- id_field
- Id_field is the data_id of current query data
- meta_key_field
- This is the column name of meta_key column (default: meta_key)
- meta_value_field
- This is the column name of the meta_value column (default: meta_value)
Examples
Example 1
Get data from following table
code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
[module.set_array query] [pagesize]50[/pagesize] [with] [sql] SELECT object_id as data_id FROM candidate_meta where coll_type=’profile’ and meta_key=’candidate_id’ [/sql] [add_field new table=candidate_meta aw2_meta_key=’created_date’ coll_id=’candidate’ /] [/with] [transform ref_id=data_id /] [meta new] [table]candidate_meta[/table] [meta_keys]first_name,last_name,email[/meta_keys] [id_field]object_id[/id_field] [/meta] [/module.set_array] [db.meta_query query=”{module.query}” dump=true /] |
Example 2
If meta_key and meta_value column name is custom then:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
[module.set_array query] [pagesize]50[/pagesize] [with] [sql] SELECT object_id as data_id FROM candidate_meta where coll_type=’profile’ and custom_meta_key=’candidate_id’ [/sql] [add_field new table=candidate_meta meta_key_field=’custom_meta_key’ meta_value_field=’custom_meta_value’ aw2_meta_key=’created_date’ coll_id=’candidate’ /] [/with] [transform ref_id=data_id /] [meta new] [table]candidate_meta[/table] [meta_keys]first_name,last_name,email[/meta_keys] [meta_key_field]custom_meta_key[/meta_key_field] [meta_value_field]custom_meta_value[/meta_value_field] [id_field]object_id[/id_field] [/meta] [/module.set_array] [db.meta_query query=”{module.query}” dump=true /] |
Example 3:
If coll_id field is a collection id of another collection then:
In this example we will get all jobs information and also filtering on it.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
[module.set_array query_filter_2] [pageno][env.pageno /][/pageno] [pagesize][env.per_page_count /][/pagesize] [with] [sql] SELECT coll_id as data_id,object_id FROM job_postings where coll_type=’job’ and meta_key=’job_id’ [/sql] [add_field new table=job_postings aw2_meta_key=’created_date’ id_field=’coll_id’ /] [filter new not_empty={env.key_skills}] [sql raw] select [module.previous_query_no /].* from job_postings join [module.previous_query_no /] on [module.previous_query_no /].data_id=job_postings.coll_id where job_postings.coll_type=’job’ and job_postings.meta_key =’key_skills’ and meta_value like ‘%[env.get key_skills /]%’ [/sql] [/filter] [/with] [transform ref_id=data_id /] [meta new] [table]job_postings[/table] [meta_keys]job_id,title,min_experience[/meta_keys] [coll_type]job[/coll_type] [id_field]coll_id[/id_field] [/meta] [atts query_count=yes /] [/module.set_array] |