Is the documentation for string functions out of date because when I try to use toLower() it i get
"An unknown function with name 'toLower' was found. This may also be a function import or a key lookup on a navigation property, which is not allowed"
I am trying to construct an OData filter to query Dynamics (CRM) - this is the code:
"queries": {"$filter": "concat('hat_',toLower('#{body('Get_record_(Preview)')?['hat_fundname']}')) eq true "}
I think the correct syntax is:
#concat('hat_', toLower(body('Get_record_(Preview)')?['hat_fundname']))
Related
I've seen the JSON array questions here and I'm still a little lost, so could use some extra help.
Here's the setup:
My Flow calls a sproc on my DB and that sproc returns this JSON:
{
"ResultSets": {
"Table1": [
{
"OrderID": 9518338,
"BasketID": 9518338,
"RefID": 65178176,
"SiteConfigID": 237
}
]
},
"OutputParameters": {}
}
Then I use a PARSE JSON action to get what looks like the same result, but now I'm told it's parsed and I can call variables.
Issue is when I try to call just, say, SiteConfigID, I get "The output you selected is inside a collection and needs to be looped over to be accessed. This action cannot be inside a foreach."
After some research, I know what's going on here. Table1 is an Array, and I need to tell PowerAutomate to just grab the first record of that array so it knows it's working with just a record instead of a full array. Fair enough. So I spin up a "Return Values to Virtual Power Agents" action just to see my output. I know I'm supposed to use a 'first' expression or a 'get [0] from array expression here, but I can't seem to make them work. Below are what I've tried and the errors I get:
Tried:
first(body('Parse-Sproc')?['Table1/SiteConfigID'])
Got: InvalidTemplate. Unable to process template language expressions in action 'Return_value(s)_to_Power_Virtual_Agents' inputs at line '0' and column '0': 'The template language function 'first' expects its parameter be an array or a string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#first for usage details.'.
Also Tried:
body('Parse-Sproc')?['Table1/SiteconfigID']
which just returns a null valued variable
Finally I tried
outputs('Parse-Sproc')?['Table1']?['value'][0]?['SiteConfigID']
Which STILL gives me a null-valued variable. It's the worst.
In that last expression, I also switched the variable type in the return to pva action to a string instead of a number, no dice.
Also, changed 'outputs' in that expression for 'body' .. also no dice
Here is a screenie of the setup:
To be clear: the end result i'm looking for is for the system to just return "SiteConfigID" as a string or an int so that I can pipe that into a virtual agent.
I believe this is what you need as an expression ...
body('Parse-Sproc')?['ResultSets']['Table1'][0]?['SiteConfigID']
You can see I'm just traversing down to the object and through the array to get the value.
Naturally, I don't have your exact flow but if I use your JSON and load it up into Parse JSON step to get the schema, I am able to get the result. I do get a different schema to you though so will be interesting to see if it directly translates.
My problem is that I need to validate my date using any validation library (joi, yup, superstruct..etc) and after that, I need to cast the date object to iso string
I use Flatpikr , react-hook-form , joi OR yup
This my approach at first glance
Flatpickr >> Date >> Validate >> toISOString() if validation succeed
I tried to achieve the first approach via yup but no hope
I tried to make a pre and post transform in yup
I opened a question in their repository explaining my steps
https://github.com/jquense/yup/issues/1153
My approach in joi didn't succeed also
i used this code
joi
.date()
.iso()
.required()
.min(new Date())
.messages({
'any.required': `Required.`,
'date.format': `Required`,
'date.base': `Should be a type of number`,
'date.min': `The date should be in future`,
});
and i have used
{ convert : false }
in joi options to prevent joi from converting the values
when setting convert to false, all of my validation schemas succeed even if my variables was required or empty
Found an solution by using
.raw()
with joi
refrences :
https://joi.dev/api/?v=17.3.0#anyrawenabled
I am trying to add a UserProperty to an email using win32com.
The UserPropertyType should be set to 'olText'.
For the record, the name of the UserProperty ('NewDomain') is already a member of the collection of Outlook UserProperties.
I have tried the following:
import win32com.client as w32c
outlook=w32c.Dispatch('Outlook.Application').GetNameSpace('MAPI')
inbox=outlook.GetDefaultFolder(6)
emails=inbox.Items
email=emails.GetLast()
email.UserProperties.Add("NewDomain",UserPropertyType='olText',True)
I got the following error:
TypeError: Add() got an unexpected keyword argument 'OlUserPropertyType'
The code works well in VBA with the syntax:
email.UserProperties.Add("NewDomain", olText, True)
Many thanks for you help!
UserPropertyType argument is an enum (int), not a string. olText is 1, so your code must be
email.UserProperties.Add("NewDomain", 1, True)
I really like how the error messages include a text string representing what the ReQL code looks like. Is it possible to get at this without forcing an error?
Example Error message:
RqlRuntimeError: No attribute `colors` in object:
{...}
in:
r.db("r_g").table("items").group("collection").ungroup().map(function(var_0) { return var_0("group").object(var_0("reduction")); }).concatMap(function(var_1) { return var_1("colors"); })
I'm wanting to get at the value after "in:" shown before I run() the query.
You can use .toString() like query.toString() (without .run(...))
It should use the same code as the one used to generate backtraces.
I opened an issue this morning to add it in the docs, it is somehow missing -- https://github.com/rethinkdb/docs/issues/354
I'm trying to do the following update using XPages Extension Library.
#{javascript:var mydata = {
product: getComponent("inputProduct").getValue()
};
var params = [1, 2];,
#JdbcUpdate("mssql","table_name",mydata,"order_no=? AND order_line_no=?",params)};
I get the error:
Error while executing JavaScript action expression
Script interpreter error, line=6, col=1: Error while executing function '#JdbcUpdate'
Invalid column name 'PRODUCT'.
The problem is that XPages when it converts the JSON it puts product to PRODUCT.
Can you set the extension library to respect the case of the JSON and not convert to Uppercase? Or can anyone point to where this setting could be set if not the extension library?
Thanks
The problem is com.ibm.xsp.extlib.util.JdbcUtil.appendColumnName()
public static void appendColumnName(StringBuilder b, String colName) {
colName = colName.toUpperCase();
b.append(colName);
}
This just needs changing to not upper case the variable.
There may be other methods that need changing if other variables are getting upper cased.