Can a SharePoint Calculated field check for existence of other columns? - sharepoint

I want to use OrderBy in SPSiteDataQuery to sort items by data, however, the field containing the date differs between the content types.
Can this be solved by sorting with a calculated field? I am currently trying to create a calculated field that checks for existence of a field (using ISERROR), if it is found it returns the value, otherwise returns a default value. Or perhaps I can create a Calculated field in parent content type, then override it's formula and field references in a child content type - would such polymorphism work?

As I found out - NO, it can't.

Related

How to create a custom field in SOLR response?

I am trying to compare two fields (say lastnames), the result should be populated on the go with other fields when I query. So can I have an option to create such custom field in solr which compares the fields and give the results when queried ?
This seems a use case for Function Values[1] .
Just explore the available function queries[2], select the one which is the best fit for you and use it as the value of a pseudo field.
[1] https://lucene.apache.org/solr/guide/6_6/common-query-parameters.html#CommonQueryParameters-FunctionValues
[2] https://lucene.apache.org/solr/guide/6_6/function-queries.html#FunctionQueries-AvailableFunctions

Acumatica Formula for Dividing 2 values

I am trying to divide values and display it in a new custom field(usrQuantity)on Stock Items Screen.
I want to divide OpenQty (which is a column in POLine) and CARTONQTY(which is not a column name but just an attribute in column AttributeID in CSAnswers table).
enter image description here
I am confused how to perform this division since CARTONQTY is not a field, I noticed that there is a field named CARTONQTY_Attributes in InventoryItem table which has been generated by some Join queries but is not actually present in the Database(checked in SQL Management Studio).
enter image description here
I tried this formula in the DAC of usrQuantity
[PXDBInt]
[PXUIField(DisplayName="Quantity")]
[PXFormula(typeof(Div<POLine.orderQty,InventoryItem.CARTONQTY_Attributes>))]
But it is giving following errors
The type or namespace name 'POLine' could not be found (are you missing a using directive or an assembly reference?)
The type name 'CARTONQTY_Attributes' does not exist in the type 'PX.Objects.IN.InventoryItem'
Do you want to store the value in the db? Typically it's not recommended practice to persist calculated values unless, for example, there's a performance issue in performing the calculation on the fly. If you don't want to store it, you probably want a PXInt instead of PXDBInt. Also, unless you always expect a whole number as a result of your division (which is unlikely), you should probably use a PXDecimal type.
To then get your calculated value into your new field, I would probably set it in RowSelecting and RowUpdated event handlers by extending the appropriate PXGraph class; in order to calculate it as you retrieve a row and when you update the row values.

Spotfire How column reranks when data is limited by expression or filtered?

I have a shapefile in Spotfire and in the tableview of it I have a column displaying DenseRank. For example, if limit data by expression from the full 100 rows in the table to just 30, the DenseRank does not change. How can I perform this task?
Thanks,
Chris
Tableview does not allow dynamic calculations, unless you have a Document Property in the expression, The calculated column expression executes whenever Document Property value chane (or Calculations refreshed), for your scenario I think instead of using filter create a property control with Fixed values (10,20,30...100) or Values from a column (the one you are using to filter data). and use Document Property linked to the Property Control in your Calculated Column Expression .....
I found a workaround to dynamically rank data based on filtering or marking. If you create a data function as simple as "tableout <- tablein" then you can pass the original filtered and/or marked table to a new table. From there, insert calculated column on the new table and it will recalculate each time.

CRecordset::IsFieldNull method replacement in bulk row fetching

I have query related to bulk row fetching using CRecordSet (MFC ODBC).
On the MSDN page, it is written that
The member functions IsDeleted, IsFieldDirty, IsFieldNull, IsFieldNullable, SetFieldDirty, and SetFieldNull cannot be used on recordsets that implement bulk row fetching. However, you can call GetRowStatus in place of IsDeleted, and GetODBCFieldInfo in place of IsFieldNullable.
Now, I want to check whether a field contains "NULL"/"has no value" data. How can I check this as the IsFieldNull function does not work in bulk row fetching?
There is the difference between IsFieldNull and IsFieldNullable function.
So logically you will not be able to know whether a filed is null for a particular row since you are doing bulk row fetching. But you can only determine whether a particular field is nullable which simply means if that field is capable of accepting null values.
The CODBCFieldInfo structure contains information about the fields in an ODBC data source.
It has a member called m_nNullability which identifies Whether the field accepts a Null value. This can be one of two values: SQL_NULLABLE if the field accepts Null values, or SQL_NO_NULLS if the field does not accept Null values.
So pass the object of CODBCFieldInfo structure to CRecordset::GetODBCFieldInfo function which collects the object by reference. So no need to worry, you will get the updated value back and then check the member m_nNullability value of that object to only know whether the filed is nullable and not whether a field for a particular row is null.
http://msdn.microsoft.com/en-us/library/xexc6xef(v=vs.80).aspx
http://msdn.microsoft.com/en-us/library/k50dcc9s(v=vs.80).aspx
CRecordset::GetODBCFieldInfo function has two versions. One version of the function lets you look up a field by name. The other version lets you look up a field by index.

SharePoint unique values from lookup

I have a list with a lookup column that is getting "Created" dates from another list, but I only want the unique date values. Is there a way to get this data or to create a calculated column with unique values?
A lookup field actually links to a single item, the display value is more a "human readable" value for the link to the items ID value.
You may also get some mileage from a normal text or even date field and using jQuery and SPServices on the edit and new forms in order to provide changes to the form for the user. This avoids doing a code level customisation for the site that a Custom Field would require.
Not out of the box I dont think. My best bet is to create a Custom Field type that extends lookup with the functionality you are after.

Resources