FlowHeater Logo

FlowHeater Support Forum

simply more productive

Download the freeware version (10 Mb)

Up to 100,000 records can be processed with the freeware version!

Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: GroupBy AutoID

GroupBy AutoID 6 years 10 months ago #2153

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.

Re:GroupBy AutoID 6 years 10 months ago #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 !

Attachment autoid_and_groupby.zip not found


Best wishes
Robert Stark

Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
Attachments:

Please Log in or Create an account to join the conversation.

Best wishes
Robert Stark

Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.

Re:GroupBy AutoID 6 years 10 months ago #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.

Re:GroupBy AutoID 6 years 10 months ago #2156

This you can do with the help of the .NET Script Heater and the following little script.
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

Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.
Attachments:

Please Log in or Create an account to join the conversation.

Best wishes
Robert Stark

Did this answer your question? We would be grateful if you provide a brief comment as feedback. It may also help others who may have encountered a similar problem.

Re:GroupBy AutoID 6 years 9 months ago #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, :)

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.177 seconds