Skip to main content

I've got a knotty problem that I can't seem to think out.

I've got a CSV file that comes out of system A (the coloured section of the image).

 

It's invoices that need paying against Purchase Orders.

An invoice starts with a H (header) and has a number of D (detail) rows.

On occasion a PO Item may have it's TAX split and the source system outputs the tax splits.

The target system can only cope with a single line per PO Item number so I create a list and group on the appropriate columns and return a list on the ones I need to aggregate...

Tax code - first code

Amount - sum of the values

Quantity - sum of the values

 

So far so good.

 

BUT the DOC_ITEM (blue) must be sequential based on the number of rows in the actual invoice.

Screenshot 2021-10-06 171650It's late in the day so my brain may have stopped working but I can't think of a way to achieve the goal...

 

How can I relate a line item back to the number of line items in the invoice and set DOC_ITEM accordingly.

 

Any help gratefully received.

 

Thanks

Assuming all the data is always coming in properly ordered and that EML.... string is a unique identifier for each invoice you can use a Counter with that attribute as the Count Domain (if I recall correctly that parameter was called Counter Name in older versions). It'll reset every time a new value for that attribute comes by.

 

Screenshot 2021-10-07 at 08.54.04


New day and lots of reading up on transformers .....

 

It's easy with a bit of SQL knowledge (and remembering that InlineQuerier is a local sqllite database).

 

SQL gives the easy capability to include a row number

 ROW_NUMBER () OVER ( 

    PARTITION BY "ITEMDATA-PO_NUMBER"

    ORDER BY "INVOICE_DOC_ITEM"

  )-1 as newDOC_ITEM

 

 

 

 


Assuming all the data is always coming in properly ordered and that EML.... string is a unique identifier for each invoice you can use a Counter with that attribute as the Count Domain (if I recall correctly that parameter was called Counter Name in older versions). It'll reset every time a new value for that attribute comes by.

 

Screenshot 2021-10-07 at 08.54.04

Ahhh thanks @Hans van der Maarel​ ...

I'm running 2020.1 version of FME and that option doesn't exist.

 

Time to work on the upgrade process. having to uninstall FME Server just to install is a bit of a pain.

 

Thanks again


Ahhh thanks @Hans van der Maarel​ ...

I'm running 2020.1 version of FME and that option doesn't exist.

 

Time to work on the upgrade process. having to uninstall FME Server just to install is a bit of a pain.

 

Thanks again

In 2020 the Counter does have that option, but it's called differently, "Counter Name" if i recall correctly, so no need to update FME Server just for that 😉


Ahhh thanks @Hans van der Maarel​ ...

I'm running 2020.1 version of FME and that option doesn't exist.

 

Time to work on the upgrade process. having to uninstall FME Server just to install is a bit of a pain.

 

Thanks again

Head banging icon....

Less haste more speed...

 

Thanks so much.

 

FME is a product in 2 halves.

 

On the one hand really good and does a huge amount...

On the other really frustrating as so many transformers do such a similar thing and the terminology doesn't always jump out to me...

 

Why use a simple Counter when I can write a nice bit of SQL and use the Inline Querier

:-)

 

Thanks again.


Ahhh thanks @Hans van der Maarel​ ...

I'm running 2020.1 version of FME and that option doesn't exist.

 

Time to work on the upgrade process. having to uninstall FME Server just to install is a bit of a pain.

 

Thanks again

Yeah, I totally understand it can be daunting sometimes. With 500-ish transformers it's not always easy to figure out which one you need to perform a certain task. Unfortunately, other than trying to break down your process into small chunks and building up experience I still haven't found the magic way to quickly get to the point where you immediately know which transformer you need. To be perfectly honest, I think I'm not saying anything too boastful if I say I'm a longtime (23 years, most of those as a Safe partner) poweruser and I probably have never used half of the transformers that are in FME right now. Nor do I know what they do.

Long story short: that's why the community is here, feel free to ask, we're happy to help. And don't be afraid to experiment 😉


Ahhh thanks @Hans van der Maarel​ ...

I'm running 2020.1 version of FME and that option doesn't exist.

 

Time to work on the upgrade process. having to uninstall FME Server just to install is a bit of a pain.

 

Thanks again

Ohhh I've never been afraid to play 😎

Out of interest how would you say Power Automate / Azure Logic apps compare?

 

I've used FME for maybe 3 years but much longer using code; FME is good for non coders and it also self documents (to a point).

 


Ahhh thanks @Hans van der Maarel​ ...

I'm running 2020.1 version of FME and that option doesn't exist.

 

Time to work on the upgrade process. having to uninstall FME Server just to install is a bit of a pain.

 

Thanks again

I don't have any experience with Power Automate or Azure Logic, so I really can't comment on that.

 

I do agree that FME is a great solution if you don't like coding. I've taught myself a number of programming languages to a somewhat competent degree over time but being visually oriented I can work a lot better and faster with FME.


Ahhh thanks @Hans van der Maarel​ ...

I'm running 2020.1 version of FME and that option doesn't exist.

 

Time to work on the upgrade process. having to uninstall FME Server just to install is a bit of a pain.

 

Thanks again

👍


Reply