How can I search for a null value in Orchestrate? - orchestrate

I'm trying to figure out how I can query for a non-existent or null value key in Orchestrate. This doesn't return any results:
db.search('events', 'value.originalDocument: null')
In the dashboard, I can see the key is there, and has a null value.

Related

Why does the request query value appear strange?

I'm making an API using Express. The request query was sent via Postman to test the GET request, but the desired result is not available.
For example, Postman created a query as below and requested it.
Key : userId, Value : 1
Key : routine[], Value : routine-ZMp#%26nSqOTv1Tsf$459Xp8Ku
Key : routine[], Value : routine-mC%26w*CU!tvTA(RE4pE%234J1d#
Key : routine[], Value : routine-Hn%23fmJ0*90AR%H)6ayLUN$TP
Key : routine[], Value : routine-%23fm%23JO
The expected log value of the routine array on the actual API server is as follows.
[routine-ZMp#&nSqOTv1Tsf$459Xp8Ku, routine-mC&w*CU!tvTA(RE4pE#4J1d#, routine-Hn#fmJ0*90AR%H)6ayLUN$TP, routine-#fm#JO]
Here's the actual log result.
[routine-ZMp#&nSqOTv1Tsf$459Xp8Ku, routine-mC&w*CU!tvTA(RE4pE#4J1d#, routine-Hn%23fmJ0*90AR%H)6ayLUN$TP, routine-#fm#JO]
The log is being output without changing the value of the second index from %23 to #. Strangely, the value of the third index is converted normally. I don't understand what the problem is. Why do you get this result?
decodeURIComponent("routine-Hn%23fmJ0*90AR%H)6ayLUN$TP")
throws a "URI malformed exception", because the % preceding the H is not percent-encoded. I assume that this value is therefore left un-decoded. The correctly encoded query value would be
Key : routine[], Value : routine-Hn%23fmJ0*90AR%25H)6ayLUN$TP

how to make string default value null in hyperledger composer model file

I want to make default value of a string parameter in a asset as null
for example
o String param
i should give default value of param as null.
Can anyone help with this?
You can't set a default value of null in the model file, and if you try and set it to null in a Transaction Function it will not be set and will be undefined.
If you create it as an Optional field and do not set a value it will still be undefined.
You can set a default of "" - an empty string. Which will return a typeof String rather than undefined.
You don't specify why you want null, but with both the empty string or the undefined value they should both return false to the test !(param)
Put default value like this
o String param default=""

How to return the Primary Key of the newly inserted row using asyncpg?

I wanted to do something like this:
async with app.pg_pool.acquire() as pg:
uid = await pg.execute('INSERT INTO users (created, keyed, key, email) '
'VALUES ($1, $2, $3, $4) RETURNING id',
time, time, key, rj['email'])['id']
However Connection.execute doesn't seem to return anything other than the status:
https://magicstack.github.io/asyncpg/current/api/index.html?highlight=returning#asyncpg.connection.Connection.execute
The question could be otherwise phrased as: How do I get back the response of the RETURNING statement when using asyncpg?
Simply use Connection.fetchval() instead of execute().
The Connection.execute will return the status of the INSERT. If you need the Record, Records or Value use one of the following instead of Connection.execute :
Connection.fetchval - returns only the value of one field specified. Returns null if no fields are specified.
Connection.fetch - will return an array of dict. Each dict will have the list of fields specified after the RETURNING statement.
Connection.fetchrow - will return a dict with the list of fields specified after the RETURNING statement

Checking for Null Values in CRM 2011 Custom Workflow Activity

I am trying to perform some logic in a CRM 2011 Custom Workflow Activity with some attributes from the calling entity. I am having an issue with determining whether a particular attribute is null or not. I have tried seemingly all combinations of GetAttributeValue and the Attributes collection, but it seems that I will always get either a Specified Cast is not Valid or Object Reference Not Set to an Instance of an Object error when there is a null value for an attribute I'm trying to access. Does anyone know the correct method for accessing an attribute that may be null? In this example, I am working with attributes of the Guid/Entity Reference type.
You can always check to see if the attributes collection contains the specific attribute that you're looking for, but you shouldn't even have to do that. All Non-nullable types (Guid, DateTime, etc) are stored as nullable types in the Attributes collection and that's probably your problem. Try something like this ( assuming late bound):
var isValid = entity.GetAttributeValue<bool?>("new_IsValid");
CRM never returns a non-nullable value. Even things that you think would be null (bool, DateTime, int, etc) are returned as their nullable equivalent. A non-nullable cast will still succeed if the value is not null, but if the value is null, it'll give you a null reference error;
object a = new bool?(true);
bool value = ((bool)a); // Works
object b = new bool?();
bool value = ((bool)b); // Null Ref Error
This syntax ended up working for me:
//if current outside counsel not null, grab GUID value
if (thisCase.lgl_outsidecounselid != null)
{
currentOCGUID = thisCase.lgl_outsidecounselid.Id;
}
//it's null, set Guid to Guid.empty
else
{
currentOCGUID = Guid.Empty;
}

Querying Sharepoint - Value does not fall within the expected range

I'm attempting to retrieve the value of a listitem but keep getting a ArgumentException - Value does not fall within the expected range.
My code is as follows:
if (resultList.Count > 0)
{
SPListItem result = resultList[0];
if (result[Column] != null)
{
return result[Column].ToString();
}
}
In the immediate window I can verify the column does exist and the value can be found in the object tree structure.
result.Fields.GetField(Column).Id
returns a Guid but using it to retrieve the value of the Field results in another ArgumentException:
result[result.Fields.GetField(Column).Id]
This could happen if you get your list item collection from view (list.GetItems(view)) or from query with ViewFields property set, in this case only the fields included in ViewFields are returned.
You need to use InternalName of the field to get its value from SPListItem
result[result.Fields.GetField(Column).InternalName]

Resources