Filtering of variable

kolaboy
Member Posts: 446
Hi;
I have a report which is displaying figures from a global variable of decimal datatype. I want to filter this variable to give say only value less than two. Say hardcoding the variable to give only values less than two.
The above line of code is calculating MonOwed, where NofMonths and NumPayments are calculated and iare also a variables. I created a request form with MonOwed as the sourceExp. I want to put say 2 in the textbox and and it should give me only MonOwed:= 2. If i also say >6, i should be about to have all MonOwed > 6 and so on. This is the filter i want. If this filter is done, it should add up the MonOwed.But its not working that way for me.
Any idea please?
I have a report which is displaying figures from a global variable of decimal datatype. I want to filter this variable to give say only value less than two. Say hardcoding the variable to give only values less than two.
MonOwed:= NofMonths - NumPayments;
The above line of code is calculating MonOwed, where NofMonths and NumPayments are calculated and iare also a variables. I created a request form with MonOwed as the sourceExp. I want to put say 2 in the textbox and and it should give me only MonOwed:= 2. If i also say >6, i should be about to have all MonOwed > 6 and so on. This is the filter i want. If this filter is done, it should add up the MonOwed.But its not working that way for me.
Any idea please?
0
Comments
-
May be I didn't catch your idea, but if you want to filter something, you need to put it into some table (e.g. temporary) and than it is not problem to filter it as you wish...0
-
Hi Kine,
how can i do this. You idea sound good, but i don't know how do go about it. Can you explain it to me with sample code to achieve this please.
Thanks0 -
I will describe it in ideas, if you do not know how to make the code for it, I recommend to read some books (manuals), do some small things... but I think that you will be able to think it out yourself.
1) Create variable of type record, for some table which have fields of type you need to sort. You can create your own or use some existing
2) In loop, where you are calculating the values, insert new record for each "variable" you want to filter with all needed values filled in into the table (record type variable) from step 1
3) Set appropriate filters to the fields you want to filter on.
4) In a loop read all records from the table - you will "see" only records for "variables" you want...0 -
thanks kine. I also have similar problem and i will be grateful if you can give us a sample code to achieve this. We need help from people like you. Thanks0
-
try in the OnAfterGetRecord trigger the following code:
IF MonOwed<=6 then CurrReport.SKIP
it will skip the dataitem line and will move to the next one0 -
IF MonOwed<=6 then CurrReport.SKIP
i have used the above code but not working.
here is my codeIF MonOwed <= 6.00 THEN BEGIN CurrReport.SKIP; END ELSE BEGIN GArreasVarTotal+=ArreasVarTotal; GTotCustBal1+=TotCustBal1; TotalmonthsOwed += MonOwed; MESSAGE('The value of %1 is %2','TotalmonthsOwed',TotalmonthsOwed) END;
Anything the problem?
[/code]0 -
where do you assign a new value to your variable:
MonOwed:= NofMonths - NumPayments;
also where (in what dataitem and what trigger) did you put the CurrReport.SKIP code ?
would be great if you post a dataitems layout of your report0 -
I just created MonOwed as a variable to store the Months owned values and the CurrReport.SKIP is place in the OnAfterGetRecord of the Cust. Ledger Entry Table.
I need to be able to filter by MonOwed.
I have two dataItems; Customer dataitem and Cust. Ledger Entry which is indented and linked by customers no. and dates.
Any Idea please?0 -
if i understood rigfht MonOwed is a parameter to set in the options preview form and then you want to compare it with (NofMonths - NumPayments)
so probably your code in the onaftergetrecord trigger should look like this:IF MonOwed <> NofMonths - NumPayments THEN CurrReport.SKIP
0 -
MonOwed is variable created ad decimal datatype which is the difference of NofMonths - NumPayments and i need to be able to filter by MonOwed.
I used request form so as to filter by MonOwed but its not working. I used the code below but not working.IF MonOwed <= 6.00 THEN CurrReport.SKIP;
what i am not doing correctly?
Thanks0 -
kolaboy wrote:MonOwed is variable created ad decimal datatype which is the difference of NofMonths - NumPayments and i need to be able to filter by MonOwed.
I used request form so as to filter by MonOwed but its not working. I used the code below but not working.IF MonOwed <= 6.00 THEN CurrReport.SKIP;
what i am not doing correctly?
Thanks
Which one is it??
1)Are you setting the Value In the Request Form
OR
2)is it the different of Months & Payments
OR
3)is it hardcoded to 6?
It can't be all three?
I can see somtheing like
MonOwed := MoOFMonth - NumOfPayments;
if MonOwed <= "VariableSetOnRequestForm"
then CurrReport.Skip;
Hardcoding a 6 or whatever does not allow for changes.0 -
I used use both the request form and the hardcoding but none of the works.
I succeeded with the hardcoding and it is skipping what is not needed, but the total at the bottom is not added the filtered value but it is adding everything.
here is the code:IF MonOwed >=13.00 THEN BEGIN CurrReport.SKIP; END; TotalmonthsOwed += MonOwed;
This is what is not totaling correctly:TotalmonthsOwed += MonOwed;
Any other ideas?
Thanks0 -
Just a small thought: Do you use the report for more than 1 customer?
In this case do you clear the NofMonths and NumPayments variables (MonOwed = NofMonths - NumPayments) for each new customer? That is to say, on the OnAfterGetRecord of Customer dataitem did you put...NofMonths := 0; NumPayments := 0;
//Bogdan0 -
I think that its necessary to solve the BUSINESS requirement, not try to hack code.David Singleton0
-
Yes i am doing it for each customer. I have not set those initialisations to zero. How do you think it will help.
Thanks0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions