NetForum includes a VIEW and a UDF that simplifies writing change log child
forms.
vw_fw_change_log_detail View
The VIEW vw_fw_change_log_detail
can be called like this, where {zzz_key} is the primary key of
the profile record being viewed:
SELECT log_key,
FIELD,
[New Value], [Old Value],
[User], [Date], [Time]
FROM dbo.vw_fw_change_log_detail
WHERE log_record_key = {zzz_key}
ORDER BY [date] DESC
To prevent showing large blocks of text on a child form, you might want to
clip the size of the values as shown below:
SELECT log_key,
FIELD,
[New Value] = convert(nvarchar(200),[New Value]),
[Old Value] = convert(nvarchar(200),[Old Value]),
[User], [Date], [Time]
FROM dbo.vw_fw_change_log_detail
WHERE log_record_key = {zzz_key}
ORDER BY [date] DESC
av_fw_change_log_customer_key UDF
The av_fw_change_log_customer_key UDF is useful for showing
old and new customer in a change log child form.
Parameters
- key (av_key). Primary Key of the record.
- mdc_name (sysname). Name of the column. Exact name or you can
use wild-card. System will match columns with a LIKE expression, not an
EQUALS expression.
Usage
Sample Child Form SQL:
SELECT log_key,
FIELD,
[New Value] = convert(nvarchar(2000),[New Value]),
[Old Value] = convert(nvarchar(2000),[Old Value]),
[User], [Date], [Time]
FROM dbo.vw_fw_change_log_detail
WHERE log_record_key = {a53_key}
AND log_mdc_name NOT LIKE 'a53%cst%'
UNION
-- special, just for cst_key values
SELECT log_key, [FIELD], [New Value], [Old Value],
[User], [Date], [Time]
FROM
dbo.av_fw_change_log_customer_key({a53_key},'a53%cst%')
ORDER BY [date] DESC