Temporary Table in Form

FrodioFrodio Member Posts: 10
edited 2004-12-17 in Navision Attain
If i make a temporary table out of the table Sales Line (Temporary Property=Yes), And insert some records in it.

Then how can i open the sales line form with these temporary records?

And also do some changes on them without Attain saving the records back to the "real database"?

I have looked for a property in the form that says like "use as temporary" or somthing. Anybody got a idea? :roll:

Comments

  • pduckpduck Member Posts: 147
    sorry this doesn't work ... i tried it too some time ago :(
  • eromeineromein Member Posts: 589
    Sure it can be done!!!!

    Anything is possible.... Either it's the correct or incorrect way to solve things...

    Take a good look to form 6510, Item Tracking Lines, in Navision attain and higher. This form is based on a temp. table. Not exactly the sample you would like to have it, but hell...

    How does it work? Well it's quite simple actaully... In theory! You will need to code the OnFindRecord and the OnNextRecord on the form.

    BUT!!!!! Be carefull... Any changes made to other objects in Navision from the temp. object will be in the "REAL" database.

    Sample: If I would validate a field in a temp. table and in OnValidate of this field programmed that a is created in the mutationlog (or any table) this record will not be in the temp. version of that record. It will be in the real database!
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • eromeineromein Member Posts: 589
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
  • Jelias1Jelias1 Member Posts: 35
    You probably know this, but you make a record variable temporary when you declare the record variable in C/AL Globals or Locals. It's a property of the variable. I've had some problems w/ temporary tables because of some stupid mistakes I've made. :?

    1. A temporary table is reinitialized to null when it loses scope, which is a good reason NOT to make a temporary table local unless you are passing it as a referenced argument.

    2. A temporary table does not keep it's value among different instance variables for the table. In other words, if a form calls functions in your table, and those functions invoke other form(s), and those forms use a record variable (other than one you pass by referenced argument, there is no association between the two distinct instances. Your record will be null.

    3. I've also had problems reinitializing a temporary record, specifying different filters, and building a new recordset. It doesn't work. The FIND or GET calls always return FALSE. Maybe it was something I was doing wrong.

    Hope this helps. :)
  • FrodioFrodio Member Posts: 10
    Thanks for alle the replays \:D/

    I disovered as you said .. it would be a monster code. So i did some work around and made some helping fields in the originale table.

    Soon done and hope it work just the way i want it to! (It's allowed to dream is it not?) :whistle:
  • Jelias1Jelias1 Member Posts: 35
    That's what I ended up doing! :shock: I declared a boolean field called Temp. When I'm done with all of the processing, I deleted the fields where Temp is flagged.
  • eromeineromein Member Posts: 589
    Guys!

    At least use a copy of the table, or am I saying something really bad here?

    BTW, Ever made an array of temorary tables? It;s real fun and could be very usefull if only it worked. But there is a major bug in it somewhere... Don't know what bug anymore tho :(
    "Real programmers don't comment their code.
    If it was hard to write, it should be hard to understand."
Sign In or Register to comment.