This topic is locked

Conditiona Formatting on Master Table based on child records Criteria

12/31/2013 2:50:57 AM
ASPRunnerPro General questions
R
rob_by68 author

Hello everyone,
In ASPRunnerPro 7.0, I would like to change the formatting on the master table record based on the value of a field in its linked detail table.
I have an "Orders" table and an "Order Detail" Table; if _all_records in the Order Details table have the value of the Field Status as "Closed", the record row in the master table should be green.
How can I accomplish this?
Thank you for your help.
Roberto
Italy

admin 12/31/2013

Roberto,
I believe you need to check this article first http://xlinesoft.com/blog/2011/01/03/tutorial_conditional_formatting/

You code needs to be added to AfterRecordProcessed event. In that event you need to execute a SQL query that check if all OrderDetails for the current order have "Closed" status. If it is - you can change row background to green.

R
rob_by68 author 12/31/2013

Thank You Sergey,
i already gave a look both at the article and the video in the Support section.
The problem is that, in these examples, all references exist in the same table (i.e. "Products") but i cannot figure out how

to code child records and reference to the Master Record to which they belong.
Could you post a sample code i could use for that manner?
Thanks again...and by the way, Happy 2014 to everybody.
Roberto
Italy

admin 12/31/2013

Here is the pseudocode for your AfterRecordProcessed event:

sql="select count * from OrderDetails where OrderID="&data("OrderID")&" and Status='Closed'"



In this event you can access the value of any field as data("FieldName")