Page 1 of 1

How to set the "CurrentDate"

Posted: Mon Jun 03, 2019 11:57 am
by johannes
Hi Community,

pls. help .... I want to automate the entry of the currentDate - how can I get the currentDate and how to set it then?

I am not firm with programming - pls. explain in a simply way - but I learn fast :D

thx
Hannes

Re: How to set the "CurrentDate"

Posted: Mon Jun 03, 2019 12:08 pm
by odklizec
Hi,

At first, please post a Ranorex snapshot (instead of screenshot) of given date element. Screenshot is not helpful for evaluation of element's capabilities and available attributes.

Generally speaking, you must create a recording variable, which you need to fill with current date, obtained, for example, by code like this:

Code: Select all

string curDate= System.DateTime.Now.ToString("DD.MM.yyyy");
Then you can fill the input element by SetValue or KeySequence action.

Re: How to set the "CurrentDate"

Posted: Mon Jun 03, 2019 12:41 pm
by johannes
Hi Pavel,

enclosed pls find the snapshot...

I created a user code module but the systems want´s to bound to a data column? How to do this

many thx

Re: How to set the "CurrentDate"

Posted: Mon Jun 03, 2019 1:22 pm
by odklizec
Hi,

You mention code module, but the screenshot you posted, looks like UserCode file, which is a part of Recording module?

In case of recording module, you can define module variable, via 'Variables' button or "as new variable" context menu.

In pure Code module, however, you need to right click in code module (under empty constructor) and select "Insert new module variable…"

In both cases, once the module variable is defined, you don't have to create a new string variable in code, but simply use the one you just created at module level.