How to solve Write Text File problem?

Hi,

I have the following codes

Eg. the text file name is test.txt

If it is not equal, in the Then side, it will write to the text file and displays ‘wrong’
If it is equal, in the Else side, it will write to the text file and displays ‘correct’

However, if I put Write Text File in the Else side, the Write Text File in the Then side will not work, it will not displays the text.

Both Write Text File in the Then and Else side use the same text file.

May I know why is it like this?

Thank you

Hi @Ying_Zhen_Lee

Have checked the condition? Also what is the path you have given for text file can you attach a workflow

Thanks,
Prankur

1 Like

Hi @PrankurJoshi,

I found out what is the problem but I have a question

I have a list of number (1,2,3,4,5,6,7,8) and a counter = 0
The number in the list is extracted from the Word Document question number. Thus the number could change. I wanted to check if the question number are in the correct order.

I put the list into a ForEach loop
Every time it goes through the loop, the counter will +1
If the number in the list is not equal to the counter, it will go to the Then side, write to text file ‘wrong’

Eg.
if list consists (1,3,4,5,6,7,8,9)
When it goes through the loop the second time, counter = 2, the number in the list = 3. It is not equal.

I found out the problem. The problem is the condition. If the last number in the list is not equal to the counter, the Write Text File in the Then side will works. If example the fourth number change (1,2,3,10,5,6,7,8), the Write Text file will go to the Else side because the last number is equal to the counter.

May I know how can I make if one of the number in the list is not equal to the counter, it will go to the Then side. If all number is equal to the counter, it will go to the Else side.

Thank you