Error in Assign Activities

Hi Team,
Hope you are well. Can you please let me know what should i give instead of string. I want to use it as a datatable.

Thanks for the help.

@srinivas_pradeep

May i know what data is ther ein varinvoiceid…if you just want it to be datatable then in variable panel change the type to datatable

Cheers

Hi @Anil_G ,

The data in the excel file which the flow is trying to read is

When i convert to datatable its giving the below error.


cheers
Sr

Hi @srinivas_pradeep

Use read range and also I guess you did not give anything in output of the read column.if you see in locals varinvoiceid is null

cheers

1 Like

Hi @Anil_G ,

Perfect. Thank you. But getting another error

@srinivas_pradeep

May I know what is invouce_output as I said this is used on datatable

cheers

Hi @Anil_G ,

Thank you for the suggestion. once i created the output it changed to ienumerable and started working. But giving this below error. Should i open a new thread or


Hi @srinivas_pradeep

when existing connection is given you need not give other parameters

cheers

Hi @Anil_G .

Thank you for the reply. Sorry i didnt understand what you mean please. Is there anything i am missing?

Cheers,
Sri

@srinivas_pradeep

In the run query activity properties for connection details…you need to fill either existing connection or the other fields…but not the both

Remove provider name and connection string as already wxisting connection is given

Cheers

1 Like

Hi @Anil_G
Thank you. I have removed the provider and connection string. Its still giving me below error.

@srinivas_pradeep

As per error it is failing at line CAMCM_SAP…Try running the query in db first and use the same syntax here

Please check this for info

cheers

1 Like

could you please elaborate more ?

Hi @Anil_G .

Thanks so much. In db its working perfectly fine the same query.
But when i am passing the list of "Invoice number " in the UiPath i think something is going wrong.

The output of invoice number in UiPath looks like this

Please find below from db

@srinivas_pradeep

I see there is a extract comma at the front of invocie…and also dont the invoicenumbers surrounded by single quotes?

Try printing the query and copy the same and run in sql and see if it works…if not make changes to it accordingly

CACM_SAP looks like a db name that you are connecting to which ideally you will be giving in connection properties I believe

Can you log on to that db and then use dbo.tablename instead of cacm_sap.dbo.tablename

cheers

1 Like

Hi @Anil_G

Thank you for the suggestion. I deleted everthing and recreated. So i could get rid of CACM_SAP error.
Where i am stuck is the passing the invoice numbers.

Assign activity - String.Join(“,”,invoice_output) - if i remove , then its giving error
“Select T1.[SYS_ID] As System_id
,T1.[ACC_DOC_NUM] As Doc_Num
,T1.[DOC_DATE] As Date
,T1.[REF_DOC_NUM] As Invoice
,T2.[PO_DOC_FX_VALUE] As TOTAL
,T2.[VENDOR_NO] As Vendor_No
,T3.VENDOR_NAME_1 As Vendor_Name
From [CACM_SAP].[dbo].[SAP_TFR_BKPF] T1
INNER Join [CACM_SAP].[dbo].[SAP_TFR_BSEG] T2 On T1.SYS_ID=T2.SYS_ID And T1.[ACC_DOC_NUM]=T2.[ACC_DOC_NUM] And T1.[FISC_YEAR]=T2.[FISC_YEAR]
LEFT Join [CACM_SAP].[dbo].[SAP_TFR_LFA1] T3 On T1.SYS_ID = T2.SYS_ID And T2.VENDOR_NO = T3.VENDOR_NO
Where T2.VENDOR_NO =‘0001009311’
And T1.[REF_DOC_NUM]= (”’ + strInvoiceID + '“)”

Its giving the error - String constants ends with a double quote.

String.Join(“‘,’”,invoice_output) Include single quotes as well

and

here single quote should be inside the double quote you gave out side

As I said print the string before you give here so that you know what string you are trying to give

cheers

Thanks @Anil_G
how do you generally print the string please?

Cheers,
Sri

@srinivas_pradeep

use log message or write line…or assign to a string variable and open it in debug mode from locals panel

cheers

1 Like

Looking at the original error, wasn’t this just a matter of a simple syntax error?

String.join([array of strings here])

The freehand format of an array is { string1, string 2, etc }, so surrounded by accolades.
I don’t see accolades in your syntax in the assign…

(I didn’t bother to read through the rest of this post so I might be missing a few vital details ;))