Display items based on child data or modify data based on child data


#1

Hi,
I face a problem where the system I use to create an app makes it difficult to use the current data I am pulling from a Wordpress install. I can go a couple of ways about it but I am having trouble either way.

I either need to query the wp_posts table based on data in the related child table wp_postmetas_by_post_id. For example display records where a wp_postmetas_by_post_id item named meta_value = a certain value but only where that items meta_key = “end_date”.

Another way I can do it is to create a new field in each wp_postmetas_by_post_id item with the value of the meta_value field where meta_key = “end_date”. This way the field would have a unique name rather than the generic title of ‘meta_value’.

I can do this for the wp_postmeta table with the following script in wp_postmeta.get.post_process

if (event.response.record) {
_.each(event.response.record, function (record, index, list) {
if (record.meta_key == “enddate”){
record.enddate = record.meta_value;
};
});
}

but this doesn’t display when calling the wp_posts table of which wp_postmeta is a related child table. Is there any way to make this happen perhaps using wp_posts.get.post_process?

I am currently using version 1.90.

Thanks for any help you can offer.


Documentation and Examples on Server-Side Scripting
#2

Solved on the following thread.

http://community.dreamfactory.com/t/documentation-and-examples-on-server-side-scripting/66/6