Abbyy For Invocies Line Item Addon (Position Field)

  • 586 Views
  • Last Post 18 April 2019
  • Topic Is Solved
MartinP posted this 24 March 2017

Hi Guys,

 

Really struggled with this one for numerous hours, had to call in the resident script god, (Not a Dev).

I'm not sure if we have missed a massive clanger here or if fundamentally there is a flaw, our "Navision" customer has an absolute requirement for the position field to be numbered:

 

Line 1, Line 2 etc.

So I assumed that the system generated line number would populate the "position" field, this is after all what it appears to represent to me, again I am stupid so this may be incorrect.

 

To cut a very long story short, "It Can't be Done" is all i've been told so far, yes it can lets make it do it is the answer we need.

 

This was the scripted solution:

 

Dim LineItemCount, LoopVar

 

LineItemCount = me.Field("LineItemsCount").Value

 

'Loop through every row in the LineItems group

For LoopVar = 0 To LineItemCount - 1    '- 1 because the rows start with zero

   me.Field("Position").Items.Item(LoopVar).Value = (LoopVar + 1)    '+ 1 to start numbering from 1

 

Next

 

Does anyone know if this was in fact achievable out of the box? Is this the logical way, have we managed to fudge it completely somehow or was the perfect?

 

As always I cant take any responsibility for the script above, it's deployment or usage here after.

 

Thanks in advance,

 

Martin

  • Liked by
  • MAlabaster
Order By: Standard | Newest | Votes
Ekaterina posted this 27 March 2017

Hello Martin,

Yes, you have found the right way to resolve the issue.

  • Liked by
  • MartinP
MAlabaster posted this 15 March 2019

Where would this script be deployed in an unattended workflow? i.e. which of the many script hooks

Ekaterina posted this 18 April 2019

Hello,

You may place the script in the " After document state changed" event hahdler.

Close