Hi guys i have problem i make filtration to customer card to see specified location as jed(there are three branches (jed-mak-rab) when i make filter i using filter group and write the following code in open form trigger of customer card form :
IF UserSetup.GET(USERID) THEN BEGIN
MESSAGE(UserSetup."User ID");
IF (UserSetup."Global Dimension 1 Code" <> '') THEN BEGIN
FILTERGROUP := 1;
SETRANGE("Global Dimension 1 Code",UserSetup."Global Dimension 1 Code");
FILTERGROUP := 0;
END;
END;
as global dimension code 1 found in user setup table.it work successfully but after two days when company need to create new customer .i press next from customer card it give me also same number why .
* my no series in financial management is value no je-tc-000001...je-tc-999999
* last customer no added is Je-TC-002700
* incremental rate by 1
* i write this code to stop filter when add new customer but it not work as following
oninsert trigger
cust1.SETRANGE("Global Dimension 1 Code",UserSetup."Global Dimension 1 Code");
cust1.SETRANGE("No.",'Jo-TC-000001','Jo-TC-999999');last number current is Jo-TC-002700
filterlocation:=cust1.GETFILTERS;
IF cust1.FIND('+') THEN
"Global Dimension 1 Code":=filterlocation ;
cust1.INSERT(TRUE);
but now when i add new customer it must come Je-TC-002701.but it not come Je-TC-002701 it come Je-TC-002700 how i will solve this problem.
although it show in table
please help me
thanks
0
Comments
thanks
This should be done withing a function, preferably a codeunit that inserts a customer and then opens the card. Not the other way around.
i know code unit but how i can do this by code unit
You do not need to clear filters in order to get the next customer number from the number series. In general, though, the code checks whether there is a value in the field before a new number is generated from the series.
If you do want to clear filters use CLEAR or RESET for the complete record, SETRANGE or SETFILTER for individual fields in one filtergroup, SETTABLEVIEW for all fields in one filtergroup (with the side effect of possibly altering your current key).
GETFILTERS reads the filters on all fields in the current filtergroup.
The "Global Dimension 1 Code":=filterlocation ; part of the above code will likely cause a runtime error, or at least set a nonsense filter.
With the find, all filters are active. You did not clear them anywhere. Furthermore, what's the intention with this. Do you really want to duplicate that customer? Shouldn't you rather use cust1.INIT?
There is no equivalent in CA/L to a form's PopulateAllFields property nor to the same functionality to primary key fields when the property is not active (in case you are looking for that).
Why do you need to create a new record programatically anyway? Should't you rather let the user use standard NAV functionality?
RIS Plus, LLC
My intention was not at all to put someone down. I just was having trouble to figure out what exactly ahmedba needed help with and thought, some punctuation marks might help. I most likely could cope with some wrongly set marks better than with none at all, but that's maybe just me. My statement was just ment as a kind request (plea? appeal?; not demand!) to help me help you.
but in filter it not show . so that i need to update global dimension code 1 to the filter name i do when i open the form.i want to assign this filter to inserted record. i write in on insert trigger of table the following
how i do that.
IF "Global Dimension 1 Code" <> '' THEN
useri:=UserSetup."Global Dimension 1 Code";
IF useri = "Global Dimension 1 Code" THEN
"Global Dimension 1 Code":=useri;
before insert function
but it not work why.
to remember you i put reset in on insert trigger of form it clear filter but he can see another global dimensions also
I need filter found and i can also insert new record but not see another global dimensions
I would do Standard NAV uses code like the following in several places (see Sales Header for an example). This disallows filters that are neither single value nor a range. Such filters will cause an error: