How to set the "CurrentDate"

Ask general questions here.
johannes
Posts: 14
Joined: Mon Oct 17, 2016 12:40 pm

How to set the "CurrentDate"

Post by johannes » Mon Jun 03, 2019 11:57 am

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
Attachments
2019-06-03 12_56_14-Testing - Ranorex Studio.png
2019-06-03 12_56_14-Testing - Ranorex Studio.png (33.35 KiB) Viewed 207 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5349
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to set the "CurrentDate"

Post by odklizec » Mon Jun 03, 2019 12:08 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

johannes
Posts: 14
Joined: Mon Oct 17, 2016 12:40 pm

Re: How to set the "CurrentDate"

Post by johannes » Mon Jun 03, 2019 12:41 pm

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
Attachments
2019-06-03 13_40_48-Testing - Ranorex Studio.png
2019-06-03 13_40_48-Testing - Ranorex Studio.png (28 KiB) Viewed 204 times
Snapshot_for_currentDate.rxsnp
(130.65 KiB) Downloaded 7 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 5349
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to set the "CurrentDate"

Post by odklizec » Mon Jun 03, 2019 1:22 pm

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.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration