# ドロップダウンに動的な値を代入する方法

**URL:** <https://forum.uipath.com/t/topic/463910>\
**Category:** フォーラム\
**Created:** [August 10, 2022, 2:55am UTC](https://forum.uipath.com/t/topic/463910 "2022-08-10T02:55:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Turtle01](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/turtle01/32/263386_2.png) [@Turtle01](https://forum.uipath.com/u/Turtle01)\
**Post date:** [August 10, 2022, 2:55am UTC](https://forum.uipath.com/t/topic/463910/1 "2022-08-10T02:55:47Z")

</div>

こんにちは。

ドロップダウンに動的な日付を入れたいのですが、うまくいきません。

・試したこと

ドロップダウンのXpathを使用しています。  
[@id=“root”]/div/div[3]/div/div[2]/div[1]/div/div[2]/div[1]/div[2]/div/button/text()

text()に{{Variables}}として動的な日付を入れようとしたら、失敗しました。

 ![スクリーンショット 2022-08-09 045301](https://global.discourse-cdn.com/uipath/original/4X/6/c/2/6c2a4fcefaeb6af01aa8e4393ac3f154bdeb0e34.png)

ちなみに、該当のドロップダウンはこれになります。  
ここに昨日や一昨日などの動的な値を入れたいです！

なにか良い方法があれば教えていただけると幸いです。

---

<div class="post-metadata">

**Author:** ![THIRU\_NANI](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/thiru_nani/32/317561_2.png) [@THIRU\_NANI](https://forum.uipath.com/u/THIRU_NANI)\
**Post date:** [August 10, 2022, 4:45am UTC](https://forum.uipath.com/t/topic/463910/2 "2022-08-10T04:45:30Z")

</div>

おい！

どこから日付を取得していますか？

エクセルからですか？

それともどこか？

変数を渡すことでそれを行うことができます。

入力日付のサンプルを見せていただけますか？

解決策を提供するのに役立つように

よろしく、  
ナニー

---

<div class="post-metadata">

**Author:** ![Turtle01](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/turtle01/32/263386_2.png) [@Turtle01](https://forum.uipath.com/u/Turtle01)\
**Post date:** [August 10, 2022, 4:51am UTC](https://forum.uipath.com/t/topic/463910/3 "2022-08-10T04:51:39Z")

</div>

The dates are the first of the last month and the end of the last month, respectively, in variables!  
I want to assign from the variables.

The input date is  
“2022/08/01”.

---

<div class="post-metadata">

**Author:** ![THIRU\_NANI](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/thiru_nani/32/317561_2.png) [@THIRU\_NANI](https://forum.uipath.com/u/THIRU_NANI)\
**Post date:** [August 10, 2022, 5:00am UTC](https://forum.uipath.com/t/topic/463910/4 "2022-08-10T05:00:18Z")

</div>

Hey!

First change the format of input date like this:

```auto
str_datetime = Datetime.ParseExact(Strinput.ToString, "MM-dd-yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("yyyy/MM/dd")

```

> Where: MM-dd-yyyy is your input date format (Change this format according to input date)  
> yyyy/MM/dd is your output format (No need to change anything here)

That’s why i asked you to provide the input date format…

Now pass the str\_datetime variable in the aaname selector

**Note:** The selector will fail while validating but when we run this will work.

Try this and let me know

Regards,  
NaNi

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [August 10, 2022, 5:00am UTC](https://forum.uipath.com/t/topic/463910/5 "2022-08-10T05:00:39Z")

</div>

こんにちは

通常UiPathではXPathを使う必要性はほとんどありません。  
単純に入力したいか所にTypeInto(文字入力）アクティビティで入力できないでしょうか？

---

<div class="post-metadata">

**Author:** ![Turtle01](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/turtle01/32/263386_2.png) [@Turtle01](https://forum.uipath.com/u/Turtle01)\
**Post date:** [August 10, 2022, 5:04am UTC](https://forum.uipath.com/t/topic/463910/6 "2022-08-10T05:04:07Z")

</div>

I’ll give it a try!

---

<div class="post-metadata">

**Author:** ![Turtle01](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/turtle01/32/263386_2.png) [@Turtle01](https://forum.uipath.com/u/Turtle01)\
**Post date:** [August 10, 2022, 5:06am UTC](https://forum.uipath.com/t/topic/463910/7 "2022-08-10T05:06:18Z")

</div>

TypeInto(文字入力）では全く反応しないんです・・。

あと、今気づいたのですが、僕がドロップダウンだと思ってたこの丸い部分は  
ボタンでした・・。

おそらくカレンダーを選択すると値が入る仕様になっているっぽいのですが  
これは先月1日から先月末日までの値を入れることはできるのでしょうか・・・？

 ![スクリーンショット 2022-08-09 045301](https://global.discourse-cdn.com/uipath/original/4X/6/c/2/6c2a4fcefaeb6af01aa8e4393ac3f154bdeb0e34.png)

---

<div class="post-metadata">

**Author:** ![N2027](https://avatars.discourse-cdn.com/v4/letter/n/5fc32e/32.png) [@N2027](https://forum.uipath.com/u/N2027)\
**Post date:** [August 10, 2022, 5:13am UTC](https://forum.uipath.com/t/topic/463910/8 "2022-08-10T05:13:48Z")

</div>

当該部分、手動の操作であれば文字入力で日付の指定できますよね？

「文字入力」が困難であれば、Ctrl＋Vでいけると思います。

---

<div class="post-metadata">

**Author:** ![Yoichi](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/yoichi/32/523754_2.png) [@Yoichi](https://forum.uipath.com/u/Yoichi)\
**Post date:** [August 10, 2022, 5:14am UTC](https://forum.uipath.com/t/topic/463910/9 "2022-08-10T05:14:16Z")

</div>

こんにちは

アプローチ案は２つあって、文字入力するか  
デートピッカーを使うかになるかと思います。

前者は選択しているセレクターの見直し、あるいは入力モードの見直しからでしょうか。

後者は例えば以下が参考になるかと思います。

> [@How to automate date picker with week inside the date picker?](https://forum.uipath.com/t/how-to-automate-date-picker-with-week-inside-the-date-picker/443662/4):
>
> Hi, As I cannot access the calendar, the following is a mock sample. Hope this helps you. colIndex = 2+CInt(dateVar.DayOfWeek) rowIndex = 4+((dateVar.Day+New DateTime(dateVar.Year,dateVar.Month,1).DayOfWeek-1) \ 7) strDay = dateVar.Day.ToString [Sequence3.xaml](https://forum.uipath.com/uploads/short-url/cLzypOrLpBe0EytVLjtfCWQ7l4b.xaml) (80.1 KB) Please see also document of dynamic selectors. Regards,
