When you are on the "Item Card Form". I disable the "No." and i put a button to load a form "Update Number Item". This form load different Part of the number on dropdownlist :
Example :
Form Item Card :
No. : BRRF30XXXX0150XXXX
....
Form Update Number Item :
No. Before : BRRF30XXXX0150XXXX
Area1 : BRR
Area2 : F
Area3 : 30
Area4 : XXXX
Area5 : 0150
Area6 : XXXX
No. After : BRRF30XXXX0150XXXX
You can change the different value of dropdownlist (the value of each dropdownlist are on a table of course)
Ex :
No. Before : BRRF30XXXX0150XXXX
Area1 : BRR
Area2 : H
Area3 : 20
Area4 : XXXX
Area5 : 0150
Area6 : XXXX
No. After : BRRH20XXXX0150XXXX
And when they validate the form i run :
It.SETCURRENTKEY("No.");
It.SETFILTER("No.",CodeItem);
It.FIND('-');
It.DELETE;
CodeFin := Codetemp;
It."No." := Codetemp;
CaptFin := Descriptemp;
It.Description := Descriptemp;
It.INSERT;
It.GET(It."No.");
MESSAGE('L''Article '+CodeItem+' a été renommé '+It."No.");
That Update the Item Table !
But when i go back to the Item Card i'm not on the Item i just modify but on the next one on the list before i modify it !
I don't know how to return a value a record Item or the number of Item to go back on the modify Item ? How can i do that ?
0
Comments
UpadatingForm.RUNMODAL; // However you want to run it
ReturnValue := UpdatingForm.AccessFunction();
// Do what you want with returned value.
http://computerz.free.fr/temp/UpdateNumberItem.JPG
I run the form with this command.
But i can't run this command because the command wait i close the form "UpdatingForm" to continu if i run my form "Updating Form" with Form.run that's ok i can run some fonction but i don't know how run a fonction when the form "UpdatingForm" close.
I think the key here is that your function changes the field which is actually the primary key.
So, returning to the main form, navision tries to do find('=><') which means to find the record with your old no, and if not found, find the next one in alphabetical order, and if that is not found, then look for prior one.
So in your case it is normal if you renamed your record and the form finds the next no.
In your situation I really recommend you to use the solution provided by MTC, use .RUNMODAL for the no change function and after that update the current record to the new number.
If you desperately want to have not modal window of this no change function, then in this case you can use SingleInstance codeunit as a global variable repository to set and update certain information there. OnClose of your service function you could pass some info to that codeunit and OnActivate of your main form you can process that information from that SingleInstance codeunit. You can search here on forums in order to learn more about these codeunits
http://navisionfreak.blogspot.com/
Justas Janauskas
All I can see is that you delete the old item and create a new one... Is that correct?!?
To show the newely created item on the form that you use a get on the Rec variable, like:
And if I may comment, why do you delete the old item? That way you lose the connection of posted documents to that item.
The Delete function deletes the record of the item without executing the OnDelete trigger of the Item table and so leaves junk in the secondary tables of the Item table, like Item Valuation Cost table in the database.
Using It.Delete(TRUE) is the appropriate way... But you might get an error message about the existance of recs about that item.
Maybe you want to make a mass rename of the item instead?? or disable the old item (block) and create a new one...
Arhontis
https://forum.mibuso.com/search
What about the Item Ledger Entry that has been posted for the Item that you deleted?
You want the Item Ledger Entry (and other tables) from the old Item to be visible under the new item?
The whole functionality is just a "No." changing of an item?
Arhontis
https://forum.mibuso.com/search
I do a DELETE and a INSERT because i can't use MODIFY !
Yes I want all table from the old Item being visible under the new Item.
thx for your help
In order to get the new item no. back to your parent form and use it to find the new item, then you just have to make a function on your child form like GetNewItemNo that returns the CodeTemp and in the parent form, after the code that calls the child form to call that routine like:
Arhontis
https://forum.mibuso.com/search
Arhontis
https://forum.mibuso.com/search
That exactly what i need !!!! i don't see the RENAME fonction i'm really ....
By the way, welcome to mibuso...
Arhontis
https://forum.mibuso.com/search
Hi there,
In relation to this proposed solution above, which is more relevant to my situation, I have implmented it as above, but cannot get the value to return to parent form for some reason?? Assume the following for explanatory purposes :-
Parent Form = FormA
Popup Form = FormB
When FormB is called, using RUNMODAL statement, FormB updates a global variable on FormB called SelectedItemNo.
There is also a function on FormB called ReturnItemNo with a return value called rReturnItemNo. This function simply assigns SelectedItemNo to the return variable rReturnItemNo.
In FormA I then issue following statements :-
FormB.RUNMODAL();
ItemNo := FormB.ReturnItemNo();
Can anybody tell me what am I doing wrong here?? ](*,)
Thanks,
Jay