Hi everyone,
I have one more problem, I need to add one more field as row in my task and i have to get the row number based on the group i.e.
If i have three columns say company code, product code, amt.
I need to add another column for the rows. the output should come in this way.
abc,coke,120,1
abc,coke,140,2
abc,pepsi,30,1
abc,pepsi,40,2
abc,pepsi,240,3
cdf,coke,60,1
cdf,pepsi,50,1
I tried to compare with the previous record and if they are same i tried to increment but i could able to solve it for two rows but if there are more than two rows its not working ,can any one suggest me the code for this problem.
Thanks in advance
Issue
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
I dont have a clear understanding on your approach but If i'm doing this I will try something like this:
I have not tested this but this should work.
Code: Select all
Sort rows using company code and product code.
Assign the initial values for all stage variables as empty ( '' )
svOldComp = svNewComp
svNewComp = Link1.CompCd Column
svOldPrd = svNewPrd
svNewPrd = Link1.PrdCd Column
svSeqNum = If svNewComp <> svOldComp And svNewPrd <> svOldPrd Then 1 Else If svNewComp = svOldComp And svNewPrd <> svOldPrd Then 1 Else If svNewComp = svOldComp And svNewPrd = svOldPrd Then svSeqNum +1 Else 1
Arun
Do we need to initialize the svseqnum or is it not required as ther will be empty value in svseqnum if we dont initializearunkumarmm wrote:I dont have a clear understanding on your approach but If i'm doing this I will try something like this:
I have not tested this but this should work.Code: Select all
Sort rows using company code and product code. Assign the initial values for all stage variables as empty ( '' ) svOldComp = svNewComp svNewComp = Link1.CompCd Column svOldPrd = svNewPrd svNewPrd = Link1.PrdCd Column svSeqNum = If svNewComp <> svOldComp And svNewPrd <> svOldPrd Then 1 Else If svNewComp = svOldComp And svNewPrd <> svOldPrd Then 1 Else If svNewComp = svOldComp And svNewPrd = svOldPrd Then svSeqNum +1 Else 1