mibuso.com

Microsoft Business Solutions online community
It is currently Sat May 25, 2013 6:37 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [Solved] Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 9:32 am 
Offline

Joined: Mon Jun 22, 2009 7:06 pm
Posts: 77
Country: Netherlands (nl)
Ik wil op een report een stuk tekst weergeven als er aan bepaalde voorwaarde voldaan wordt.

De code is als volgt:

IF "Purchase Line".Element = '%.20.%' THEN BEGIN
Locatie := Text013
END ELSE BEGIN
Locatie := ''
END;


De bedoeling is dus dat locatie text013 wordt als er in elementveld .20. voorkomt

Wat doe ik fout?


Last edited by Red-Eagle on Fri Jun 22, 2012 1:49 pm, edited 1 time in total.

Top
 Profile E-mail  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 10:19 am 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3294
Location: Wilrijk
Country: Belgium (be)
% kan je in een SQL statement gebruiken maar niet in C/AL voor het filteren.

Kijk eens naar de on-line help van STRPOS en wijzig de IF in:
IF STRPOS("Purchase Line".Element,'.20.') > 0 THEN BEGIN

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 10:39 am 
Offline

Joined: Mon Jun 22, 2009 7:06 pm
Posts: 77
Country: Netherlands (nl)
Bedankt voor de hulp, heb nu de volgende code gedaan:


IF STRPOS("Purchase Line".Element,'.20.') > 0 THEN BEGIN
Locatie := Text013;
END ELSE BEGIN
Locatie := '';
END;


Helaas is resultaat nog steeds leeg. Wanneer ik gewoon alleen locatie := text013 neem krijg ik wel resultaat, dus dat gedeelte zit in ieder geval goed

Het element wat in het veld staat is 01.20.0100, maar dit kan ook bijvoorbeeld 02.20.0200 zijn.


Top
 Profile E-mail  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 11:14 am 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3294
Location: Wilrijk
Country: Belgium (be)
STRPOS werkt in ieder geval naar behoren zoals je met deze code zelf kan uittesten:

Code: Select all
codElement := '01.20.0100';

IF STRPOS(codElement,'.20.') > 0 THEN
  MESSAGE('.20. aanwezig')
ELSE
  MESSAGE('.20. niet aanwezig');

Misschien dat de record-var "Purchase Line" niet correct is?
Of dat deze code uitgevoerd wordt nadat Locatie al is afgedrukt?

Moeilijk te zeggen zonder alle code te zien.

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 11:43 am 
Offline

Joined: Mon Jun 22, 2009 7:06 pm
Posts: 77
Country: Netherlands (nl)
Dat begrijp ik. Met de code is ook niks waarschijnlijk. De plek kan natuurlijk wel.

Dit zijn de dataitems van het rapport:

DataItem Name
Purchase Header <Purchase Header>
Integer CopyLoop
Integer PageLoop
Purch. Comment Line <Purch. Comment Line>
Integer DimensionLoop1
Purchase Line <Purchase Line>
Integer RoundLoop
Integer DimensionLoop2
Integer VATCounter
Integer VATCounterLCY
Integer Total
Integer Total2
Integer Total3
Integer Total4


Purchase Header - OnAfterGetRecord()
// Buitenmontage voor krat

IF STRPOS("Purchase Line".Element,'.20.') > 0 THEN BEGIN
Locatie := Text013;
END ELSE BEGIN
Locatie := '';
END;

// Buitenmontage voor krat

Heb je hier al wat meer aan?


Top
 Profile E-mail  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 11:59 am 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3294
Location: Wilrijk
Country: Belgium (be)
Als Locatie op regelniveau wordt afgedrukt, dan moet je code in de Purchase Line dataitem staan.
Wordt Locatie afgedrukt op de header, dan moet je nog een FIND doen om een inkoopregelrecord op te halen in de Purchase Header dataitem. Als er dan regels zijn met verschillende Locaties (met en zonder '.20.' in het veld Element) dan heb je wellicht probleem.

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 12:12 pm 
Offline

Joined: Mon Jun 22, 2009 7:06 pm
Posts: 77
Country: Netherlands (nl)
Locatie wordt op headerniveau afgedrukt. Van die regelnummers weet ik, maar voor de situatie dat wij dit rapport gebruiken komt dit niet voor.


Top
 Profile E-mail  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 1:03 pm 
Offline

Joined: Mon Jun 22, 2009 7:06 pm
Posts: 77
Country: Netherlands (nl)
Ik heb nu dit van de code gemaakt:


IF "Purchase Line".FIND('-') THEN BEGIN
IF STRPOS("Purchase Line".Element,'.20.') > 0 THEN
Locatie := Text013;
END ELSE BEGIN
Locatie := '';
END;


maar nu neemt hij altijd text013


Top
 Profile E-mail  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 1:10 pm 
Offline
Site Admin
MVP Microsoft Dynamics NAV
NAV TechDays 2013 attendee

Joined: Sun Nov 07, 1999 8:01 am
Posts: 3294
Location: Wilrijk
Country: Belgium (be)
Als je geen filters hebt gezet voor de velden "Document Type" en "Document No." dan heeft ie het verkeerde record opgehaald.

_________________
No support using PM or e-mail - Please use this forum.
Search is your friend || Mark your Topic as SOLVED (= green checkmark) when your question is answered || Read the Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2013 - 7 & 8 November 2013 ««« Visit the conference website: www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: Tekst op rapport bij bepaalde gelijkenis veld
PostPosted: Fri Jun 22, 2012 1:49 pm 
Offline

Joined: Mon Jun 22, 2009 7:06 pm
Posts: 77
Country: Netherlands (nl)
Het is gelukt bedankt voor de hulp!!

Voor de volledigheid even de code die ik heb gebruikt, mocht iemand anders ook zoiets nodig hebben:


"Purchase Line".SETRANGE("Document No.", "Purchase Header"."No.");
"Purchase Line".SETRANGE("Document Type", "Purchase Header"."Document Type");
IF "Purchase Line".FIND('-') THEN BEGIN
IF STRPOS("Purchase Line".Element,'.20.') > 0 THEN
Locatie := Text013;
IF STRPOS("Purchase Line".Element,'.30.') > 0 THEN
Locatie := Text013;
END ELSE BEGIN
Locatie := '';
END;


Top
 Profile E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to:  
cron