This can not be resolved by using field properties ( Exclude Char) feature since Line Item is of Table type and there is no such properties.
Custom Sub Routine would be way forward, following is a sample -
Private Sub LineItems_ValidateTable(pTable As SCBCdrPROJLib.ISCBCdrTable, pWorkdoc As SCBCdrPROJLib.ISCBCdrWorkdoc, pValid As Boolean)
'======================================
'By Sandeep
'======================================
Dim i As Integer
For i = 0 To pWorkdoc.Fields("LineItems").Table(0).RowCount -1
'Replacing some known characters identified during debug
pWorkdoc.Fields("LineItems").Table(0).CellText("Unit Price", i)=Trim(Replace(CStr(pWorkdoc.Fields("LineItems").Table(0).CellText("Unit Price", i)),".",""))
pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)= Trim(Replace(CStr(pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)),".",""))
pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)= Trim(Replace(CStr(pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)),".",""))
Next
End Sub
Above is a sample code to replace any char and assign the replaced value back to line Items.
Based on business required we can change the values and assign the calculated values agaain.
If Total field has comma replaced by decimal, form a logic to check length of post decimal string and decide if decimal is actual decimal or comma. Accordingly replace comma with "" and assign back.
Custom Sub Routine would be way forward, following is a sample -
Private Sub LineItems_ValidateTable(pTable As SCBCdrPROJLib.ISCBCdrTable, pWorkdoc As SCBCdrPROJLib.ISCBCdrWorkdoc, pValid As Boolean)
'======================================
'By Sandeep
'======================================
Dim i As Integer
For i = 0 To pWorkdoc.Fields("LineItems").Table(0).RowCount -1
'Replacing some known characters identified during debug
pWorkdoc.Fields("LineItems").Table(0).CellText("Unit Price", i)=Trim(Replace(CStr(pWorkdoc.Fields("LineItems").Table(0).CellText("Unit Price", i)),".",""))
pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)= Trim(Replace(CStr(pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)),".",""))
pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)= Trim(Replace(CStr(pWorkdoc.Fields("LineItems").Table(0).CellText("Total", i)),".",""))
Next
End Sub
Above is a sample code to replace any char and assign the replaced value back to line Items.
Based on business required we can change the values and assign the calculated values agaain.
If Total field has comma replaced by decimal, form a logic to check length of post decimal string and decide if decimal is actual decimal or comma. Accordingly replace comma with "" and assign back.
No comments:
Post a Comment