Update SubForm
elTorito
Member Posts: 191
Hi,
i have here trouble with Update a Form.
I Have a Form with a subform.
In Form Header i Have to important Fields:
Code and Subname.
The Data in Header cames from Table1, where i Have Primary Key on Field Code. The Subname Field has FieldClass FlowFilter in Table1. In Table2 exists Primary Key: "Code,Subname".
Then i Have a subform that looks me Entries in Table3 what have Key: "Code,Subname,LineNo".
In SubForm Propertys i have follow SubFormLink:
Subname=FIELD(FILTER(Code)),Subname=FIELD(FILTER(Subname))
(In Table Filter i have put ValueIsFilter)
When i get Next Record my subform updates correctly, it seems me all entries with the Selected Code in Form Header.
If i put data in Subname Field , it updates too correctly my subform, but only if Data in Table3 exists that have Key: "Code,Subname".
If They no exists records with "Code,Subname" then Navision it Brekas me out with an error that Record does not exists.
So i would Reset the Filter with the Subname, so that it not end with an error, but i don't know in what trigger or the location where i can put the code for does correctly this, i have tried with an Function that checks me with the actual Data (Code and Subname) if Record Exists in Table3, when NOT Find a Record, then must Reset Filter for Subname.
Then i have tried, without SubFormLink, and have tried with :
CURRFORM.SUBFORM.UPDATE(); But it says me that message like: SubForms are no permitted to update.
Very dificulty my english ... #-o
I Hope you can help me anyway.
Thanks
i have here trouble with Update a Form.
I Have a Form with a subform.
In Form Header i Have to important Fields:
Code and Subname.
The Data in Header cames from Table1, where i Have Primary Key on Field Code. The Subname Field has FieldClass FlowFilter in Table1. In Table2 exists Primary Key: "Code,Subname".
Then i Have a subform that looks me Entries in Table3 what have Key: "Code,Subname,LineNo".
In SubForm Propertys i have follow SubFormLink:
Subname=FIELD(FILTER(Code)),Subname=FIELD(FILTER(Subname))
(In Table Filter i have put ValueIsFilter)
When i get Next Record my subform updates correctly, it seems me all entries with the Selected Code in Form Header.
If i put data in Subname Field , it updates too correctly my subform, but only if Data in Table3 exists that have Key: "Code,Subname".
If They no exists records with "Code,Subname" then Navision it Brekas me out with an error that Record does not exists.
So i would Reset the Filter with the Subname, so that it not end with an error, but i don't know in what trigger or the location where i can put the code for does correctly this, i have tried with an Function that checks me with the actual Data (Code and Subname) if Record Exists in Table3, when NOT Find a Record, then must Reset Filter for Subname.
Then i have tried, without SubFormLink, and have tried with :
CURRFORM.SUBFORM.UPDATE(); But it says me that message like: SubForms are no permitted to update.
Very dificulty my english ... #-o
I Hope you can help me anyway.
Thanks
(Oo)=*=(oO)
0
Comments
-
Pfffooo ! Let's see if I've understood....
You have 3 tables and 1 form (with a subform)
On table one the primary key is Code and you have a flowfield (lookup) based on Table 2,
On Table 3 you have entries linked to the header by Code field....
Two problems apprently :
1/ If your subname field on table 1 is a flowfield, you need to calculate it... and you shouldn't have a subformlink through that field...
2/ The usual subform link is not :Subname=FIELD(FILTER(Code)),Subname=FIELD(FILTER(Subname))
but :Code=FIELD(Code),Subname=FIELD(Subname)
Now question is.... how can you have a flowfield for the Table 1 Subname field if the primary key on Table 2 is Code,Subname ?
Is it really a "Flowfield" or it is a Table relation ? In that case, you should'nt have any more problem....My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
In Table1 Propertys of "Code" i have FlowFilter and Table Relation
("Table2".Subname WHERE (Code=FIELD(Code))
In Table1 ist Key: "Code"
In Table2 is Key for: "Code,Subname"
In Table3 is Key for "Code,Subname,LineNo"
Then i have One Form wich is based on Table1
In this Form i have the Field "Subname" such as Filter (when i pressed it, appears a Form wich List me the avaibles Subnames for each Code)
In this Form always i have a Subform wich is based on Table3.
And every time i change Subname or Code the Subform must show/update entries.
This works nice, if Records exists where the Filter is aplicable,
For example:
I Have 3 Records in Table1:
Code1
Code2
Code3
in Table2 I have:
Code1, Subname1
Code1, Subname2
Code1, Subname3
Code2, Subname1
in Table3 i have:
Code1,Subname1,10000
Code1,Subname1,20000
Code1,Subname1,30000
Code2,Subname1,10000
I RUn my form and it starts with first record (Code1) , the subform displays me nothing, because no entry exists with Code1 and Subname=''.
Well, i choose Subname='Subname1', then SubForm displays me follow records:
Code1,Subname1,10000
Code1,Subname1,20000
Code1,Subname1,30000
Now when i go to the next record from Table1, the Filter for Subname is placed, and subForm displays me imediately follow entries:
Code2,Subname1,10000
But now if i go to the Record (from table1) with Code='Code3'
Then Applications Breaks Out with an error and say me that no exists Record in Table 3 with Code='Code3', Subname='Subname1'
And this is what i would prevent, when this occurs i would reset filter or would give out an error that no recors exists, after this error navision close the form and exit to Menü, this is silly...
I Hope is better explained now
:oops:(Oo)=*=(oO)0 -
Are you sure ? It seams impossible to have a Flowfilter on a primary key....In Table1 Propertys of "Code" i have FlowFilter and Table Relation
("Table2".Subname WHERE (Code=FIELD(Code))
:shock:My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
philippegirod wrote:
Are you sure ? It seams impossible to have a Flowfilter on a primary key....In Table1 Propertys of "Code" i have FlowFilter and Table Relation
("Table2".Subname WHERE (Code=FIELD(Code))
:shock:
hmm.
In Table1 follow Fields:
"Code", "Subname"
Code has DatayType Code and is Primary Key.
Subname has Dataype Code and has FieldClass Filter.
"Code" Is Only primary Key.
In Table2 are Fields:
"Code" as DataType Code
and Subname as DataType Code.
Primary Key in Table2 is: "Code,Subname"(Oo)=*=(oO)0 -
Have you tried a Currform.UPDATE; on the form, field Subnam, OnAfterValidate trigger ?My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
philippegirod wrote:Have you tried a Currform.UPDATE; on the form, field Subnam, OnAfterValidate trigger ?
Yes i have tried yet this, but it doesn't work ...
...
Now i have init another way for solution my problem perhaps it is better , but i have too problems to realised it , and i have hedache now #-o
I have now One Form, i would make 2 fields with Lookups, in first field i want choose my Code from Table1, in second Lookup must be a filter so that i only can view subnames with the same Code selected , then when selected Subname it must Update TableBox....
I Have now my own 2 fields, and the first lists me my codes from table 1, but in second field i don't check how i must set the Filter, everytime it lists me all subnames for all codes...
So i go along intend to finish this (with machine gun?) :^o
Thanks ..(Oo)=*=(oO)0 -
And what about a simple variable (text for instance) and, in the form, for this field, you link it to your Table 2 with a TableRelation. If you are in the forum today 2 march 2005 (german time ;-)) i stay in the pulp chat, we can disccus that...My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light0 -
THANKS FOR YOU HELP
=D> =D>(Oo)=*=(oO)0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions