- Posts: 109
GroupBy AutoID
- JD Cox
- Topic Author
- Offline
- User
Less
More
13 years 3 months ago #2153
by JD Cox
GroupBy AutoID - Post(2153) was created by JD Cox
Need to number line items from a flat file of orders during the import. Orders with more than one line item are numbered 1, 2, 3, etc… I have researched this and tried several things but cannot get the desired results. Using the GroupBy function on the order number and the AutoID function (GroupBy) it comes close. It starts with 1 on the first record then 2 with the second even if it’s another order. However, multi line orders it numbers in sequence but starts with 2 as does every record but the first.
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
- Offline
- Admin
13 years 3 months ago #2154
by FlowHeater-Team
Best wishes
Robert Stark
Replied by FlowHeater-Team on topic Re:GroupBy AutoID - Post(2154)
hi,
i guess you have just forgotten to switch on the autoid "groupby effect on" option?
i've made a little example to demonstrate how it’s works. please have a look to the attachment.
note: the groupby heater only works proper with sorted records !
i guess you have just forgotten to switch on the autoid "groupby effect on" option?
i've made a little example to demonstrate how it’s works. please have a look to the attachment.
note: the groupby heater only works proper with sorted records !
Attachment autoid_and_groupby.zip not found
Best wishes
Robert Stark
Attachments:
Please Log in or Create an account to join the conversation.
- JD Cox
- Topic Author
- Offline
- User
Less
More
- Posts: 109
13 years 3 months ago #2155
by JD Cox
Replied by JD Cox on topic Re:GroupBy AutoID - Post(2155)
Robert, thanks for the reply. However, I did not forget the GroupBy Effect I tried to show that in my post. I do appreciate the .zip file. Where you have the ID GroupBy it gives a total count of the records in each group. I want to show each record in the group numbered 1, 2, 3, etc… which we use on the write side. Thanks again JD
Please Log in or Create an account to join the conversation.
- FlowHeater-Team
- Offline
- Admin
13 years 3 months ago #2156
by FlowHeater-Team
Best wishes
Robert Stark
Replied by FlowHeater-Team on topic Re:GroupBy AutoID - Post(2156)
This you can do with the help of the .NET Script Heater and the following little script.
Code:
int iOrderCount = 1;
string sLastOrder = String.Empty;
public object DoWork()
{
if (InValues.Length != 1)
throw new Exception("one input parameter expected");
// get the first input parameter
string sOrder = (string)InValues[0].GetString();
if (sLastOrder == sOrder)
{
iOrderCount++;
}
else
{
iOrderCount = 1;
}
sLastOrder = sOrder;
return iOrderCount;
}
Attachment custom_groupby_autoid.zip not found
Best wishes
Robert Stark
Attachments:
Please Log in or Create an account to join the conversation.
- JD Cox
- Topic Author
- Offline
- User
Less
More
- Posts: 109
13 years 2 months ago #2157
by JD Cox
Replied by JD Cox on topic Re:GroupBy AutoID - Post(2157)
Robert I cannot thank you enough…that’s exactly what I’ve been trying to do.
I’ve been programming with access for over 10 years. Flowheater has made importing and exporting data so much easier. And now it looks like I’m going to need to learn a little more about the .NET script.
Thanks again,
I’ve been programming with access for over 10 years. Flowheater has made importing and exporting data so much easier. And now it looks like I’m going to need to learn a little more about the .NET script.
Thanks again,
Please Log in or Create an account to join the conversation.
Time to create page: 0.277 seconds