nohandlesleft254
IS-IT--Management
Hi,
I have a bit of code that adds and removes lines in a query. The lines represent items that can either be individual items or parts of a multi-part item. The field that shows this difference is called PlanRef.
Plan Ref Item Code
1 BU40
2 BU80
3 D3DP60
3 BGE
3 NID
4 BU80
etc
My problem occurs when someone deletes an item that comes before on of the multi-part items. E.G if someone deleted the first item 'BU40', the resulting query would be this:
Plan Ref Item Code
1 BU80
2 D3DP60
3 BGE
3 NID
4 BU80
The query gets renumbered every time the page loads but obviously should be re-numbering as per lines with matching PlanRefs... any ideas? My re-number code is below...
<!--- Re-Sequence each row --->
<cfset NewPlanref = 0>
<cfoutput query="Session.NewQuoteItems" group="PlanRef">
<cfif NewPlanref gt 0>
<cfset NewPlanref = NewPlanref +1>
<cfelse>
<cfset NewPlanref = 1>
</cfif>
<cfoutput>
<cfset QuerySetCell(Session.NewQuoteItems, "PlanRef", NewPlanref, Session.NewQuoteItems.CurrentRow)>
</cfoutput>
</cfoutput>
I have a bit of code that adds and removes lines in a query. The lines represent items that can either be individual items or parts of a multi-part item. The field that shows this difference is called PlanRef.
Plan Ref Item Code
1 BU40
2 BU80
3 D3DP60
3 BGE
3 NID
4 BU80
etc
My problem occurs when someone deletes an item that comes before on of the multi-part items. E.G if someone deleted the first item 'BU40', the resulting query would be this:
Plan Ref Item Code
1 BU80
2 D3DP60
3 BGE
3 NID
4 BU80
The query gets renumbered every time the page loads but obviously should be re-numbering as per lines with matching PlanRefs... any ideas? My re-number code is below...
<!--- Re-Sequence each row --->
<cfset NewPlanref = 0>
<cfoutput query="Session.NewQuoteItems" group="PlanRef">
<cfif NewPlanref gt 0>
<cfset NewPlanref = NewPlanref +1>
<cfelse>
<cfset NewPlanref = 1>
</cfif>
<cfoutput>
<cfset QuerySetCell(Session.NewQuoteItems, "PlanRef", NewPlanref, Session.NewQuoteItems.CurrentRow)>
</cfoutput>
</cfoutput>