Automatically fill values in rows with the value in the previous row (in the sample Project Code)
Friederike Mundt
[color=#282828][font=helvetica, arial, sans-serif]**** Purpose of the customize rule ****[/font][/color][color=#282828][font=helvetica, arial, sans-serif]Attached is 1 customize optimizer rule which fills the project column with the value from the previous row when selecting a new item. The rule is valid for all Sales and Purchasing documents.[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]****Requirements for this customize rule ****[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]The rule requires coresuite Version 3.40 or higher and SAP Business One 8.8 or higher.[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]**** Procedure to use[/font][/color][color=#282828][font=helvetica, arial, sans-serif] the customize rule[/font][/color][color=#282828][font=helvetica, arial, sans-serif] ****[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]1. Download the attached *.cocu file[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]2. Import in SAP Business One view > Administration > Add-Ons > coresuite customize > Import / Export > Import rules > All Active[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]3. Open any new Sales or Purchasing Document, for example Sales Order.[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]4. Enter Business Partner and one item row[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]5. Add a Project (not coresuite time but standard SAP Business One Project) to the first row[/font][/color]
6. Add Item in second row
7. Check the value in the Project in the second row
>> The value is automatically filled wit the project entered in the first row.
[color=#282828][font=helvetica, arial, sans-serif]**** Procedure to adjust[/font][/color][color=#282828][font=helvetica, arial, sans-serif] the customize rule[/font][/color][color=#282828][font=helvetica, arial, sans-serif] ****[/font][/color]
If you want to copy the value of a different column to the next row adjust the parameter "[color=#282828][font=helvetica, arial, sans-serif]columnUID" with the id of the corresponding column.[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]Sample (Optimizer Rule C#):[/font][/color]
/*
***** General Information *****
Creator: coresystems ag, muf@coresystems.ch
Create Date: 2012-03-21
***** StartConfDesc *****
This rule fills the project code with the value selected in the previous row
***** EndConfDesc *****
***** Updates *****
2012-03-21, muf: Initial Rule
*/
// Here Project Code (ColumnUid = 31), adjust this if you need to copy a the value of a different column to the next row
string columnUID = "31";
string ruleName = pVal.RuleInfo.RuleName.ToString();
string errorMessage = "Error in Optimizer Rule '" + ruleName + "'";
try
{
//StatusBar.WriteWarning("DEBUG - Rule: " + ruleName + " was triggered.");
Matrix oMatrix = Matrix.GetFromUID(pVal.Form, "38");
int currentRow = oMatrix.Rows.Count - 2;
if (currentRow > 0)
{
string project = oMatrix.GetValue(columnUID, currentRow - 1);
oMatrix.SetValue(columnUID, currentRow, project);
}
}
catch(System.Exception ex)
{
MessageBox.Show(errorMessage + ": \n" + ex.Message, "OK");
StatusBar.WriteError(errorMessage + ": " + ex.Message);
Debug.WriteMessage(errorMessage + ": " + ex.Message, Debug.DebugLevel.Exception);
}
return true;
0
Please sign in to leave a comment.
Comments
0 comments