Unable to use BRApi.Database.LookupRowFieldValue in Spreadsheet BR

CraigA
New Contributor III

Hi all.

We have a spreadsheet rule that needs to pull a value from another database table.

The lookup runs successfully in an existing Dashboard Extender, and I was initially requesting the amount by calling the Extender from the spreadsheet rule, but that only ever returned the default value, even though the lookup does have a valid value.

Because that failed to return a value, I tried making the call directly, as shown:
sOperational_Capacity = BRApi.Database.LookupRowFieldValue(si, "ExternalDB", "XFC_STEP3_DEV2_OperationalCapacity", objDbwheres, "Operational_Capacity", 9876).XFConvertToDecimalLocal

NB: The 9876 is just a default value that is different to zero, so that I recognise it, and we use the ConvertToDecimalLocal to deal with French culture users.

Basically, when I run the call from the spreadsheet rule (either directly or by calling the Extender rule), I receive the default value every time.

This same code runs perfectly from the Extender BR, returning the correct value.

I have also checked the values of the objDbwheres and they are spot on, and return the correct value when used in the Extender rule.

1 REPLY 1

JackLacava
Community Manager
Community Manager

Try doing that lookup explicitly, see if it raises any error. If you don't know how, look at this solution, particularly the section where we open the connection and execute a query. I would also check the rights of your user; depending on the connection configuration in server properties, they might not be able to query it.