Temporary Recordset Confusion

headley27
Member Posts: 188
I need to parse a single field from an existing table down to distinct values and then pass those values into a form (list).
I have an issue passing the values to the form.
I have setup a temporary record variable 'RecDistinct' and am successfully parsing the list down which, I have confirmed.
On my form there is a single field linked to recDistinct.Tier1.
What is displayed on the form is only the last distinct value, repeated a number of times (equivalent to the amount of records in the non-distinct table) and I am unsure how to correct this.
I must be missing something simple.
Many thanks in advance.
I have an issue passing the values to the form.
I have setup a temporary record variable 'RecDistinct' and am successfully parsing the list down which, I have confirmed.
On my form there is a single field linked to recDistinct.Tier1.
What is displayed on the form is only the last distinct value, repeated a number of times (equivalent to the amount of records in the non-distinct table) and I am unsure how to correct this.
I must be missing something simple.
Form - OnOpenForm() CLEAR(recDistinct); IF Rec.FIND('-') THEN REPEAT IF (recDistinct.Tier1 <> Rec.Tier1) THEN BEGIN recDistinct.INIT; recDistinct := Rec; recDistinct.INSERT; END; recDistinct := Rec; UNTIL Rec.NEXT=0; IF recDistinct.FIND('-') THEN REPEAT MESSAGE(recDistinct.Tier1); UNTIL recDistinct.NEXT=0;
Many thanks in advance.
0
Comments
-
IMPORTANT : "recDistinct" MUST be a temptable!!!!!
Form - OnOpenForm()// Clean old values in the temptable recDistinct.RESET; recDistinct.DELETEALL(FALSE); IF Rec.FIND('-') THEN REPEAT recDistinct.RESET; recDistinct.SETRANGE(Tier1,Rec.Tier1); IF NOT recDistinct.FINDFIRST THEN BEGIN recDistinct := Rec; recDistinct.INSERT; END; UNTIL Rec.NEXT=0; IF recDistinct.FIND('-') THEN REPEAT MESSAGE('%1',recDistinct.Tier1); UNTIL recDistinct.NEXT=0;
Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks kriki,
I am using 3.7 so I can't use the FINDFIRST function.
I guess that I should mention that I am confused because my Temporary Table 'RecDistinct' does contain the correct distinct values (which I have confirmed by the Message function), but I am not sure that I am 'linking' the form field properly to the Temporary Table.
Am I correct by 'linking' the field to recDistinct.Tier1 via the SourceExpr property or should I be doing something else?0 -
Instead of FINDFIRST, you can use FIND('-')
You need "SourceExpr" to link it. But you temptable didn't contain the correct records.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
IF recDistinct.FIND('-') THEN REPEAT MESSAGE(recDistinct.Tier1); UNTIL recDistinct.NEXT=0;
is returning the expected values.
I can't figure out why my form is not grabbing the values that the message box gives me.
Something is missing here but I just don't see it.
Thanks for your assistance kriki.0 -
headley27 wrote:
IF recDistinct.FIND('-') THEN REPEAT MESSAGE(recDistinct.Tier1); UNTIL recDistinct.NEXT=0;
is returning the expected values.
I can't figure out why my form is not grabbing the values that the message box gives me.
Something is missing here but I just don't see it.
Thanks for your assistance kriki.
Use this new form to show the records of the temptable and see if they are correct. If they are correct, it means your old form has some error in it. If the are wrong, it means that the values you expected are wrong.
To call a form based on a temptable:FORM.RUNMODAL(FORM::"The Form",recDistinct);
And "recDistinct" is your temptable.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
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