SUBSTRING Function - via a tempory table?

r44712r44712 Member Posts: 40
Hi all, happy new year.

I'm trying to perform the following:

For a G/L Entry, if its G/L Account No. contains the substring 'DUM' to set a flag field accordingly. I realise that Navision doesn't have a concept of a SUBSTRING function, and frustratingly the 'DUM' sequence is not in the same place everytime (i.e. its not always the 1st three characters).

What I have done is (GLEntryTemp is defined as being a 'Tempory' variable):
GLEntryTemp.COPY("G/L Entry");
  
  GLEntryTemp.RESET;
  GLEntryTemp.SETFILTER("G/L Account No.",'%1','*DUM*');

  //IF (GLEntryTemp.COUNT > 0) THEN tempFS := 'D';                     //Account No.s containing 'DUM'....

  //IF GLEntryTemp.FIND('-') THEN tempFS := 'D';

  IF NOT(GLEntryTemp.ISEMPTY) THEN tempFS := 'D';
END;

This works so far as copying the record to the temporary store, and no further....

The two commented-out lines represent alternative ways that I have tried to get it working (no luck!).

SO the question is what I'm trying to do, do-able, or do I need to approach the problem differently?


Thanks for any advice!

Comments

  • kinekine Member Posts: 12,562
    Look at STRPOS function... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • r44712r44712 Member Posts: 40
    Job's a good'un - thanks. \:D/
  • krikikriki Member, Moderator Posts: 9,110
    A completely different possibility:
    If you want to create DUMMY-accounts, why not create a new toggle "Dummy Account" in the G/L Account table and set that flag for your dummy accounts? That solution is, I think, a lot better. Like this you can use anything for your account No.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.