Object Tag and Search

This project was formerly called "Product Attribute Search and Reporting". It was renamed as a result of  (1) bypassing the Product Attribute architecture and (2) extending the concept to BP. The purpose of this page is to help you understand the design and implementation process of the Object Tagging and Reporting project. This project was born from the conversation labeled "2014-04-15 AM – Open Discussion" starting at 0:26:30.

2014-05-01 PM - Object Tag and Search Introduction, Demonstration and Installation Instructions

Next Steps

  1. Create iDempiere plugin (DONE)
  2. Create the Source view for M_Storage (ChuBoe_TagSource_Storage_V) (DONE)
  3. Create my ChuBoe_TagSource records (ex: Storage) (DONE)
  4. Create the model for ChuBoe_TagInstance (DONE)
  5. Create the Process to populate the results table (DONE)
  6. Update ChuBoe_TagInstance model to set the AD_Column_ID when any of the 'IDs are not null.
Develop the process to populate the search results table. (DONE)
  1. Iterate across ChuBoe_TagInstance columns to gather the distinct IDs (M_Product_ID, C_BPartner_ID
  2. Update the below query to include the above columns as limiters
    1. ex. m_product_id in (...)
    2. ex. c_bpartner_id in (...)
    3. ex. new_column_id in (...) (just in case someone adds a new column)

Design Document

* Plugin Name * com.chuboe.objecttag * Package Name * com.chuboe.objecttag * Window/Table Structure * * Table Definition * ChuBoe_Tag - Normal Columns ChuBoe_TagValue - Normal Columns - ChuBoe_Tag_ID ChuBoe_TagInstance - Normal Columns - C_BPartner_ID - M_Product_ID - ChuBoe_Tag_ID - ChuBoe_TagValue_ID (limited by Tag_ID relationships) - ChuBoe_TagSearch_Param_ID ChuBoe_TagSearch_Param - Normal Columns - StartDate - EndDate - ChuBoe_TagSource_ID - SearchStamp - Do_Search (button) - isSearchStampChanged - isIncludeNoAttribute (allows products with no attributes to be included in the results) ChuBoe_TagSearch_Result (where result.SearchStamp = param.SearchStamp) - Normal Columns - ChuBoe_TagSearch_Param_ID - SearchStamp - StartDate - EndDate - C_BPartner_ID - C_BP_Group_ID - M_Product_ID - M_Product_Category_ID - C_Order_ID - C_OrderLine_ID - C_Invoice_ID - C_InvoiceLine_ID - M_Production_ID - M_ProductionLine_ID - M_InOut_ID - M_InOutLine_ID - Qty - Amt ChuBoe_TagSource - Normal Columns - AD_Table_ID * Programming Objects * - Models for above tables - Create views to populate _Target records - Param param.method for creating where clause used to limit _Result records - Process for creating _Result records - Param method for creating SearchStamp

Sample Query to Tie Product to Attribute Values

  1. Get Source View from ChuBoe_TagSearch_Param
  2. Get list of Result ColumnNames from T&C for ChuBoe_TagSearch_Result (java List)
    1. Note: assumes the source view represents (has) all columns of ChuBoe_TagSearch_Result
    2. This will be used in the insert statement's VALUES and SELECT list
  3. Issue Delete statement for ChuBoe_TagSearch_Result
  4. Iterate through ChuBoe_TagSearch_Param -> ChuBoe_TagInstance records
    1. Order by AD_Column_ID, ChuBoe_Tag_ID, ChuBoe_TagValue_ID
    2. Create a map
  5. FYI - AD_Column_ID ' s ColumnName (ex: C_BPartner_ID, M_Product_ID).
    1. drives the where clause 'IN' statement (ex: C_BPartner_ID IN ...   or    M_Product_ID IN ...)
    2. drives the select clause in the sub query (ex: select C_BPartner_ID from ...    or     select M_Product_ID from ...)
  6. AD_Column_ID and ChuBoe_Tag_ID drive teh sub query's where clause
  7. Said another way, for every unique combination of AD_Column+ID and ChuBoe_Tag_ID, inject a WHERE CLAUSE based on the above logic where you look for the associated ChuBoe_TagValue_IDs. See below example.
delete from chuboe_tagsearch_result;
insert into chuboe_tagsearch_result
select
ad_client_id,
ad_org_id,
null::numeric as amt,
null::numeric as c_bpartner_id,
null::numeric as c_bpartner_location_id,
null::numeric as c_bp_group_id,
1000001::numeric as chuboe_tagsearch_param_id,
null::numeric as c_invoice_id,
null::numeric as c_invoiceline_id,
null::numeric as c_order_id,
null::numeric as c_orderline_id,
created,
createdby,
null::timestamp without time zone as enddate,
'Y' as isactive,
null::numeric as m_inout_id,
null::numeric as m_inoutline_id,
null::numeric as m_product_category_id,
m_product_id,
null::numeric as m_production_id,
null::numeric as m_productionline_id,
qtyonhand as qty,
null::character varying(36) as searchstamp,
null::timestamp without time zone as startdate,
updated,
updatedby
from M_storageonhand
where m_product_id in --driven by AD_Column_ID
(
select m_product_id --driven by AD_Column_ID
from chuboe_taginstance
where ad_column_id = 1000124
and chuboe_tag_id = 1000000 --driven by ChuBoe_Tag_ID
and chuboe_tagvalue_id in (1000005, 1000006) --driven by collection of ChuBoe_TagValue_IDs
)
and m_product_id in --example of same AD_Column_ID, different ChuBoe_Tag_ID and ChuBoe_TagValue_IDs
(
select m_product_id
from chuboe_taginstance
where ad_column_id = 1000124
and chuboe_tag_id = 1000001
and chuboe_tagvalue_id in (1000002)
);

Instructions to Add a new Tag Type

  1. Add the new column to ChuBoe_TagInstance (ex: C_BPartner_Location_ID)
  2. Add a new Tag tab below the appropriate tab (ex: Add Tag tab below BP window --> Location tab)

Instructions to Add a new Tag Source

  1. Create a new view similar to ChuBoe_TagSource_Storage_V
  2. Create a new Tag Source record and point it to your new view (above)

2014-04-17 PM Topic Introduction Meeting

2014-04-22 AM - Object Tag and Report Design Review - Session #2