Dynamic data import / export

datenbank

simply more productive
Up to 10,000 records can be processed with the freeware version!
Welcome, Guest
Username: Password: Remember me
Welcome to the FlowHeater support forum.

Questions about using FlowHeater are answered here.

TOPIC: GroupBy AutoID

GroupBy AutoID 5 years 2 months ago #2153

  • JD Cox
  • JD Cox's Avatar
  • Offline
  • Junior Member
  • Posts: 39
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.
The administrator has disabled public write access.

Re:GroupBy AutoID 5 years 2 months ago #2154

  • FlowHeater-Team
  • FlowHeater-Team's Avatar
  • Offline
  • Administrator
  • Posts: 240
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

Attachments:
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.
The administrator has disabled public write access.

Re:GroupBy AutoID 5 years 2 months ago #2155

  • JD Cox
  • JD Cox's Avatar
  • Offline
  • Junior Member
  • Posts: 39
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
The administrator has disabled public write access.

Re:GroupBy AutoID 5 years 2 months ago #2156

  • FlowHeater-Team
  • FlowHeater-Team's Avatar
  • Offline
  • Administrator
  • Posts: 240
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

Attachments:
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.
The administrator has disabled public write access.

Re:GroupBy AutoID 5 years 2 months ago #2157

  • JD Cox
  • JD Cox's Avatar
  • Offline
  • Junior Member
  • Posts: 39
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, :)
The administrator has disabled public write access.
Moderators: FlowHeater-Team
Time to create page: 0.081 seconds