Hi together, I want to insert a new record in the non-editable item card (F30) being able to use the assist button to select a no. series. Depending on the status of an item the form is editable or non-editable. If the user wants to add a new record and actually is positioned on an item record for status non-editable this is not possible. I do not need to assgin F3, I was thinking about a different shortcut, perhaps Alt-F3, but this is not the point that we need to discuss. I found the following topics dealing with the issue, but not with the no. series, using the search terms ‘F3, form editable’: http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=11235 http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=2780 http://www.mbsonline.org/forum/topic.asp?TOPIC_ID=8177 Any ideas? Used version: Navision 4.0
Joerg, what is your question?
David, thanx for asking, maybe my original post is confusing? I am looking for a way to insert a new record in the database. Situation: I have the form e.g. the item card non-editable, because a field (a status) of the currently displayed item record results in displaying the form non-editable (CurrFORM.EDITABLE(FALSE)). So shortcut F3 is not working. I want to give the user the possibility to insert a new record either with using a freely assigned item number or using the default number series or selecting a number series from several existing number series for items using the assist button. I found no way to do this and want to know if someone has a solution for this. I tried to explain that I was already searching in the database before I did my post.
Try to make a new MenuIterm ‘New’ with shortcut F3. This will override the normal F3 shortcut. Then put in code like CLEAR(Item); Item.INIT; Item.“No.” := ‘’; Item.INSERT(TRUE); IF GET(Item.“No.”) THEN; In the OnPush() trigger Regards, Mark
Hi Joerg, this is clear now. The problem you have is that basically you need to handle 4 differnet conditions. 1/ Form is currently editable, so jst let the user do things normally, 2/ Form is Not editable, and user wants to create an Item based on the default series. 3/ Form is Not editable, and user wants to create an Item based on a number series that thye select with assist edit. 4/ Form is Not editable, and user wants to create an Item No. Manually. This is all doable. (the code above from arq will sort of help you with scenario 2, but not the rest). My recomendation which will be the least trouble some solution, is to create a new Form based on Item. Have an absolute minimum of fields on it (just those needed to enter a new Item, such as No. Description Posting groups etc.). Then whent he user presses F3, have this new form open, and then let the user create the new Item from there. (Open the form modally, and return to the new record when you close). The other alternative would be to temporarily set the form to editable whent he user presses F3, but I can see that that could negate the reason for you making it non editable. Hope this helps.
What I finally did: Changes in item card (Form 30) New menu item with shortcut Alt-F3. Code in OnPush trigger:
IF ItemL.GET('') THEN ItemL.DELETE; RESET; SETRANGE("No.",''); CurrForm.UPDATE; CurrForm.EDITABLE(TRUE); Code in the OnValidate trigger of field No.:
SETRANGE("No."); Code in the OnAssistEdit trigger of field No.:
IF AssistEdit THEN BEGIN SETRANGE("No."); CurrForm.UPDATE; END; Remarks: If the user is positioned on a record that results in form being editable, standard functionality (shortcut F3) is still working. If the user is positioned on a record that makes the form non-editable, he can use Alt-F3. Probably the Alt-F3 will get more often used as more and more items get into the status that result in a non-editable form (think of a status ‘Released’).
Hmm looks quite odd, does this mean that when the user creates a new item, that they are asked to rename an existing record? This may seem fine in your test database, but it is going to be very slow int he live system.
Nope, no asking for rename. That wouldn’t be good, I agree. If somehow the item record with No. = ‘’ exists it is deleted (see code). After that I have a setrange on the non-existing record. For a validation or AssistEdit the filter is then removed.