web stats
write increasing number into a variable - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 03-12-2019, 07:29 AM
con con is offline
OBX.1 Kenobi
 
Join Date: Nov 2018
Location: Berlin
Posts: 42
con is on a distinguished road
Default write increasing number into a variable

Hello, can't find anything about it, maybe someone could help:

I want to build a own number, which is stored as a global channel variable and is incremented by one and than back stored. Than can be called again with the incremented value.

Is there any possibility in Mirth to do this without including a database?
Reply With Quote
  #2  
Old 03-13-2019, 12:16 PM
agermano agermano is offline
Mirth Guru
 
Join Date: Apr 2017
Location: Indiana, USA
Posts: 1,159
agermano is on a distinguished road
Default

You can do this, but global variables do not persist across reboots, so if it is important that the number doesn't reset you will want to write it somewhere permanent, either to a database or the filesystem.

You'll also have to take extra care if your channel will be multi-threaded.
Reply With Quote
  #3  
Old 03-13-2019, 11:57 PM
con con is offline
OBX.1 Kenobi
 
Join Date: Nov 2018
Location: Berlin
Posts: 42
con is on a distinguished road
Default

Thanks for your answer. I have got the same judgement and implement a database call. I thought MirthCachedRowSet has a possibility to write a persistence value somewhere in an internal database.
what is also interesting took me some time: you need a result.getObject('columname') to access the value of a database call.

But I am no JavaScript native..
Reply With Quote
Reply

Tags
channelutil, counter, ids, stored procedure, variable

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 11:45 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Mirth Corporation