How to search on the basis of property Type in AEM - search

i want to search a property whose type is String[]. In my repository same property have both type 'String' & 'String[]' . i want to extract only those whose type is String[]. for this i'm using below query
path=/content/flip/us/usa/en_us/home/homepage
type=cq:PageContent
1_property=imageRotate
1_property.value=0
1_property.Type=string[]
But i getting result of String property also. Is there any way to achieve this.

When you are searching for the multivalue properties you need to search with more than one value. as the type is same for both it only differs in the storage with multi valued.
Example to retrieve Multivalue property is as shown below
path=/content/geometrixx-outdoors
type=nt:unstructured
property.and=true
property=imageRotate
property.1_value=0
property.2_value=1
property.Type=string[]
XPathQuery :
/jcr:root/content/geometrixx-outdoors//element(*, nt:unstructured)
[
(#imageRotate = '0' and #imageRotate = '1')
]

Related

Type cast string to another type

I am not sure just how possible this is but I am trying to receive text 'BoxFit.cover' from my data source, then type cast it and have it assigned to a variable of type BoxFit. This will allow me to customise my application via my datasource which is on a cloud database
BoxFit kLoginScreenBoxFit = 'BoxFit.cover' as BoxFit;
I get an error " type 'String' is not a subtype of type 'BoxFit' in type cast". is there a way of doing this?
I am not sure just how possible this is but I am trying to receive text 'BoxFit.cover' from my data source, then type cast it and have it assigned to a variable of type BoxFit. This will allow me to customise my application via my datasource which is on a cloud database
BoxFit kLoginScreenBoxFit = 'BoxFit.cover' as BoxFit;
I get an error " type 'String' is not a subtype of type 'BoxFit' in type cast". is there a way of doing this?
BoxFit is an enum. Therefore, you can match it by name by searching it's values like so:
BoxFit boxFit = BoxFit.values.firstWhere((e) => e.toString() == 'BoxFit.cover');

Can I dynamically set a PXDataFieldAssign parameter of a PXDataFieldParam object?

I have code that sets the PXDataFieldAssign value as follows:
pf = new PXDataFieldAssign<xTACProjectTask.dueDate>(someValue);
I also have a table, holding the DAC field names, such as "xTACProjectTask.dueDate". This table also has a checkbox field to determine whether to use this DAC field as a parameter.
Is there a way to not have the DAC fieldname hard-coded, and instead (maybe using a 'typeof' call?) use the results of the table query to set that field name - like the following?
pf = new PXDataFieldAssign<typeof("xTACProjectTask.dueDate")>(someValue);
or, using my query result:
pf = new PXDataFieldAssign<typeof(query.value)>(someValue);
with query.value being the value in the table holding the DAC field name?
You can create it using Type.GetType and Activator.CreateInstance. Please see the example below:
string typeName = "PX.Objects.IN.InventoryItem+descr,PX.Objects";
Type typeArgument = Type.GetType(typeName);
Type genericClass = typeof(PXDataFieldAssign<>);
Type constructedClass = genericClass.MakeGenericType(typeArgument);
object created = Activator.CreateInstance(constructedClass,new object[] { "Test Description" });
You will get the below wrapped into object in the created

Property selection is not supported on values of type 'Integer'

I would like to send this dynamic content:
content:#concat(formatDateTime(adddays(utcnow(),-1),'mm'),formatDateTime(adddays(utcnow(),-1),'dd'))
from web activity in Azure Data Factory to logic Apps.
on the logic app side I have defined such a body:
in the second step I would like to extract the value:
but after running at this step I get this error:
InvalidTemplate. Unable to process template language expressions in action 'Extract' inputs at line '1' and column '1292': 'The template language expression 'triggerBody()?['ID']' cannot be evaluated because property 'ID' cannot be selected. Property selection is not supported on values of type 'Integer'. Please see https://aka.ms/logicexpressions for usage details.'.
How can I solve this problem?
Add
Content-type = application/json
in request header.
From my test and your error message, your ID in your content must be like this:
{
"ID":222223
}
In this way, The ID would be in String type. So you need to change your ID into String type like this:
{
"ID":"222223"
}
Or change your JSON Schema "ID" type to Integer and the Variable Type to Integer. Then the logic apps will work.

what's the meaning of "type tags" in nodejs

assert.deepStrictEqual(actual, expected[, message]) in nodejs's docs:
Type tags of objects should be the same.
what's the meaning of "type tags"
const date = new Date();
const object = {};
const fakeDate = {};
Object.setPrototypeOf(fakeDate, Date.prototype);
// Different type tags:
assert.deepStrictEqual(date, fakeDate);
typeof date and typeof fakeDate ,The results are all object, but different type tags
Type tags in Javascript, are referred to the word returned by typeof
For example for primitive values:
typeof({}) // returns 'object', this is the type tag
For non-primitive:
Object.getPrototypeOf(new Date) // returns 'Date {}' this is the type tag
If typeof is used with Date it will returns object which is right, because that would be the type tag for the primitive value, this is why using Object.getPrototypeOf is more accurate.
In the firsts JS implementations, the type tag were stored the first 1–3 bits and the the remaining 29–31, contained the actual data.
What the NodeJS docs says, it's that the result of Object.getPrototypeOf function when comparing two objects has to be the same to be considered as equal.
This is an old question that has been already answered, but I thought I might add that, although:
In the first implementation of JavaScript, JavaScript values were
represented as a type tag and a value. The type tag for objects was 0.
null was represented as the NULL pointer (0x00 in most platforms).
Consequently, null had 0 as type tag, hence the typeof return value
"object".
Type tags can also refer to an object's toStringTag.
The Symbol.toStringTag well-known symbol is a string valued property
that is used in the creation of the default string description of an
object. It is accessed internally by the Object.prototype.toString()
method.
The value associated to the well-know Symbol.toStringTag is used as the default string description of an object. Since every built-in object has a toStringTag value (except for null prototypes), it can be used to detect an object's class.
There's a package called typetags that has more information about it: typetags.org

The binary operator NotEqual is not defined for the types

I am trying to filter some elements like this:
model = model.Where(feature => item
.Input
.Contains(feature
.GetType()
.GetProperty(item.Attribute)
.GetValue(feature)
.ToString()));
item is an object that receives data about the filtering, for instance item.Input is a List<string> containing what the user filled in and item.Attribute (is string) is the column I'm supposed to look at. The field I've tested the error on is a field of type Guid? and it's called AssignedUserId and the curious thing is that this works:
model = model.Where(feature => item.Input.Contains(feature.AssignedUserId.ToString()));
As a note, this works:
model = model.Where(feature => feature
.GetType()
.GetProperty(item.Attribute)
.GetValue(feature)
.ToString() == item.Input.ElementAt(0));
So item.Attribute is populated well, and the filter works.
The error I'm getting is:
System.InvalidOperationException: The binary operator NotEqual is not defined for the types 'Microsoft.EntityFrameworkCore.Storage.ValueBuffer' and 'Microsoft.EntityFrameworkCore.Storage.ValueBuffer'.
What's the problem with getting the field value like in the first code sample?
which version of entityframework are u using?
i got the same error and this is already fixed in 2.1.0-preview1 release like is discussed here issue 9771

Resources