Compare in a database

Hi guys, it’s a pleasure to greet you, I have the following business rule and I would like to know if you can support me, I need to compare in a database if an invoice number exists 15 days ago.
Thanks a lot.

Hi @IOrlando

Welcome to the UiPath Community!
The answer to your question depends on what is captured in the source database.
If the database contains information about the creation date of the invoice, then you can certainly compare today’s date to the creation date and deduce the difference.

Use DateDiff function for this.

I hope this helps.
Happy automation!

@IOrlando

Need more clarity from where you are comparing the invoice number? please put the example.

Regards
Anand

For greater clarity, I have the invoice number that I extracted from a PDF and I must verify that this number exists or not in the database 15 days ago.

I need to capture from the database if the invoice number exists in a period of 15 days.

@IOrlando

First put the query to fetch the data from database .

CONVERT(date, DATEADD(DAY, -15, GETDATE()))

store this on DataTable variable and use for each row. Inside for each you can compare the Invoice number.

ex. For each
{
PDFInvoice Number=“XXX”

For Each row
{
DatabaseInvoiceNumber = row(3).toString !-- Example

If (PDFInvoice.equal(DatabaseInvoiceNumber)
{
Do your activity
}
else
{
Data not match
}

}

}

I think this way you can do this.

Regards
Anand

1 Like

Thanks, but maybe you have another option? because it doesn’t work for me. :frowning:

Hi @IOrlando
The solution proposed by @anandji05 should do the trick.

Can you please elaborate as to why it doesn’t work for you?
Is this related to database access issues? Have you tried something and failing or are you looking for something completely different?
Please share more details on the nature of the problem so someone can help.

Regards.