Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

Store Global variables in Temporary Table

(0) ShareShare
ReportReport
Posted on by 44

Hello all,

I have the need to modify the originals methods JmgJobBundle\makeRegistration() and  JmgJobBundle\postTime() in order to insert a new custom column (AKS_CostCategory)  value in the JmgTermReg and JmgStampJournalTrans tables respectively.

the obstacule I have is that the values I need are declared in \Forms\JobRegistration which are ProdId prodId and RouteCostCategoryId costCatId . bypassing those values into jmgJobBundle class requires to change a lot parameters from many methods.

I wonder you guys can advice me if creating some kind of temporary table (AKS_CostCategoryTEMP) would be a good idea so i can store those values there and the access those values globally inside those methods by calling

IF (aks_CostCategoryTEMP) 

     AKS_CostCategoryTEMP::find().CostCatId

or is there a better way?

  • Suggested answer
    CBNestor Profile Picture
    CBNestor 44 on at
    RE: Store Global variables in Temporary Table

    Happy to say that I have tried again this morning. system made automatic clock out and click in, added new jobStarts and is working like a charm

    I cannot beleave that I Windows reset would help to fix that strange behavior.

    Thank you guys again for your help!. "Alone we might go faster, but togheter we go farther" in this community go faster and farther!

    Now I need to change the CategoryHoursId and price from ProdJournalRoute and ProdRouteTrans tables to finish the logic. but that would be another thread :) 

    pastedimage1593072019511v1.png

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: Store Global variables in Temporary Table

    I will leave the jobs as active for few workers without clocking them out. Tomorrow morning I will Clock them In and start new jobs. If the Category is written properly I will make this Thread as Solved finally. by now everything I working like a charm

    Thank you guys Nikolaos and Martin for your great help and your time. It's a joy having you here!. again, I am greatly appreciated!

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Store Global variables in Temporary Table

    Restart could definetely help with some cache issues.

    Quite often strange issues are resolved by full build in the system. But I can imagine also restart resolving some problems.

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: Store Global variables in Temporary Table

    Hi Martin,

    I am not touching the Update() statement (not for JmgTermReg but for JmgStampJournalTrans) Actually that method is not called when all jobs are already stopped and just one JobStart is being performed, Is beign called when a JobStopt is made (when clocking-out or clockin-In when the next day when the worker forgot to clock out the day before for example),

    the one that is beign called is createJournalSignIn() but as said is only when a JobStart is triggered

    I am only interested in the Insert() when a StartJob is performed and that is in Classes\JmgTermJob_Prod\makeRegistration().

    the EDT is RouteCostCategoryId which is the same as the Origial CategoryTable.CategoryId

    everytime a walk through the code in debug. my Column is always filled with the right Category but for some ramdom reasons this extange value is inserted I a can not manage to follow it why is happening

    yeah the Tooltip is still there saying hello

    Note: While Writing this post I Made basic Windows Server Restart. I have tried again and the category has been inserted correcty 4 times in a row... I am not sure if is working now, but... Does it make sense, a restart could be the solution for a problem like that??

    I will keep testing it

    pastedimage1592995866482v1.pngpastedimage1592996129006v2.pngpastedimage1592998078917v3.png

  • Martin Dráb Profile Picture
    Martin Dráb 230,468 Most Valuable Professional on at
    RE: Store Global variables in Temporary Table

    How do you populate the value in createUpdateJournal() (which seems to be the method calling the update)? What value do you see there when you walk through the code in debugger?

    Also, are you still getting the tooltip with worker name and datetime? What EDT are you using for the field? Don't you have any table relations using this field?

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Store Global variables in Temporary Table

    I'm sorry but it's not possible for me to figure it out just by these screenshots. Would need to debug myself.

    But I'm still quite sure it is possible to figure out by using the debugger and trace parser.

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: Store Global variables in Temporary Table

    Hi Nikolaos,

    I really stuck here. Yesterday all Complilation+ CIL + Synchronization was made. The problem persist. here you can see the 4849765 that is beign inserted in the custom Column. 

    The Update sql is made only to change the last related record (not the one that is beign inserted) 

    pastedimage1592990482716v1.pngpastedimage1592990624577v3.pngpastedimage1592990733924v4.png

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: Store Global variables in Temporary Table

    In the Call tree tab page you can see all code that was executed, perhaps it gives some hints.

    Also, have you at any point done a full x++ compile, full CIL and database synchronization? I recommend to run it nightly in dev systems. Perhaps something is not up to date and that explains your issue.

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: Store Global variables in Temporary Table

    I have trace the session. when inserting a category. I can see that sometimes (as you see in code and picture) the Insert SQL does not include the custom Column (AKS_CostCategoryId) I only see one INSERT record for JmgTermReg table in that session trace. How can I get look more into the source of the problem?. Eating my brain now :/

    INSERT INTO JMGTERMREG (REGDATETIME,
    	REGDATETIMETZID,
    	WORKERPILOT,
    	WORKER,
    	WRKCTRIDPILOT,
    	REGTYPE,
    	PROFILEDATE,
    	JOBID,
    	JOBIDABS,
    	MATCHRECIDSTARTSTOP,
    	JOBACTIVE,
    	RESNO,
    	STARTITEMS,
    	GOODITEMS,
    	SCRAPITEMS,
    	FINISHEDCODE,
    	TMPGOODITEMS,
    	TMPSCRAPITEMS,
    	SYSMRPUPDATEREQUEST,
    	ERROR,
    	ERRORTXT,
    	TMPSTARTITEMS,
    	AUTOSTAMP,
    	ERRORSPECIFICATION,
    	COSTCATEGORY,
    	ONCALLACTIVITY,
    	TERMINALID,
    	PDSCWGOODITEMS,
    	PDSCWSCRAPITEMS,
    	PDSCWSTARTITEMS,
    	RETAILTERMINALID,
    	MODIFIEDDATETIME,
    	DATAAREAID,
    	RECVERSION,
    	PARTITION,
    	RECID) VALUES ('2020-6-23',
    	19001,
    	0,
    	5637145326,
    	'',
    	2,
    	'2020-6-23',
    	501,
    	'',
    	0,
    	1,
    	'Slib',
    	'1.E0',
    	0,
    	0,
    	0,
    	0,
    	0,
    	0,
    	0,
    	'',
    	0,
    	0,
    	'',
    	'',
    	'',
    	'ServerName',
    	0,
    	0,
    	0,
    	'',
    	'2020-6-23',
    	'pol',
    	1,
    	5637144576,
    	5637148588)
    pastedimage1592894406482v2.png

  • CBNestor Profile Picture
    CBNestor 44 on at
    RE: Store Global variables in Temporary Table

    thanks hehe, you were right :)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,759 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,468 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans