Generic Inquiry / Fonction Concat - acumatica

When using the concat function with certain fields, it does not respect the content.
=Concat(CStr([Account.AccountCD]),' / ',CStr([Account.Description]))
In this example, the Accountcd field is missing

Related

Azure search query to filter JSON values

I'm trying to frame Azure search query. The field type is collection(Edm.String) in Azure search index. This is how my JSON data to be filtered looks like : ["A","B"].
When I try to filter using the query Alphabet in 'A' it brings all the entries that has "A" in it. But when I try to frame the same query in my code like "'A' in Alphabet" it throws an exception stating:
"Invalid expression: Expression contains an unsupported OData language feature. Please revise your query and try again.
Parameter name: $filter".
Is there any other Azure query which I can use to filter my JSON data?
Note : I could not use eq as my field is multi valued and eq can handle only single values.
if you want to filter a collection that need to include multiple values, ie , you want to query all result whose collection all has "A" and "B" try the filter expression below :
Let's assume your collection field name is "alphabet"
$filter=alphabet/any(s: s eq 'A') and alphabet/any(s: s eq 'B')
The solution for this is to use search.ismatch query like search.ismatch('A,B','Alphabet','simple','any'). So the result will have search results of all the records having either A or B or both.
Reference : https://learn.microsoft.com/en-us/azure/search/query-odata-filter-orderby-syntax

Netsuite Custom Field with REGEXP_REPLACE to strip HTML code except carriage return

I have a custom field with some HTML code in it:
<h1>A H1 Heading</h1>
<h2>A H2 Heading</h2>
<b>Rich Text</b><br>
fsdfafsdaf df fsda f asdfa f asdfsa fa sfd<br>
<ol><li>numbered list</li><li>fgdsfsd f sa</li></ol>Another List<br>
<ul><li>bulleted</li></ul>
I also have another non-stored field where I want to display the plain text version of the above using REGEXP_REPLACE, while preserving the carriage returns/line breaks, maybe even converting <br> and <br/> to \r\n
However the patterns etc... seem to be different in NetSuite fields compared to using ?replace(...) in freemarker... and I'm terrible with remembering regexp patterns :)
Assuming the html text is stored in custitem_htmltext what expression could i use as the default value of the NetSuite Text Area custom field to display the html code above as:
A H1 Heading
A H2 Heading
Rich Text
fsdfafsdaf df fsda f asdfa f asdfsa fa sfd
etc...
I understand the bulleted or numbered lists will look crap.
My current non-working formula is:
REGEXP_REPLACE({custitem_htmltext},'<[^<>]*>','')
I've also tried:
REGEXP_REPLACE({custitem_htmltext},'<[^>]+>','') - didn't work
When you use a Text Area type of custom field and input HTML, NetSuite seems to change the control characters ('<' and '>') to HTML entities ('<' and '>'). You can see this if you input the HTML and then change the field type to Long Text.
If you change both fields to Long Text, and re-input the data and formula, the REGEXP_REPLACE() should work as expected.
From what I have learned recently, Netsuite encodes data by default to URL format, so from < to < and > to >.
Try using triple handlebars e.g. {{{custitem_htmltext}}}
https://docs.celigo.com/hc/en-us/articles/360038856752-Handlebars-syntax
This should stop the default behaviour and allow you to use in a formula/saved search.

Using custom table to feed drop-down list datasource

Let's assume that I have Custom Table named Possible URL target parameters with code name xyz.PossibleTargets with 2 columns:
Explanation and Value.
How to feed drop-down field on page type with data to have Value (from table) as Value and Explanation as name in drop-down?
What I already tried and it is not working:
Generate value;name pairs divided by newline and place it as List of options:
z = ""; foreach (x in CMSContext.Current.GlobalObjects.CustomTables["xyz.PossibleTargets"].Items) {z += x.GetValue("Value"); z +=";"; z += x.GetValue("Explanation"); z += "\n" }; return z;
Validator do no allow me to do such trick.
Set option Macro expression and provide enumerable object:
CMSContext.Current.GlobalObjects.CustomTables["xyz.PossibleTargets"].Items
In Item transformation: {%Explanation%} and in Value column {%TargetValue%}.
This do not work also.
Dropdown configuration
How to do this correctly? Documentation and hints on the fields are not helpful.
Kentico v11.0.26
I think that you should do it without marking field as a macro. Just type there the macro. Take a look on screen
No need to use a macro, use straight SQL, using a macro only complicates what appears to be a simple dropdown list.
SELECT '', '-- select one --' AS Explanation
UNION
SELECT TargetValue, Explanation
FROM xyz_PossibleTargets -- make sure to use the correct table name
ORDER BY ExplanationText
This should populate exactly what you're looking for without the complication of a macro.

Haskell Persistent BackendFilter

I'm trying to use the match operator of Sqlite3 FTS3/4 tables with Persistent (in Yesod).
I've succeeded in creating my own match operator:
-- | Implements the `match` operator. This operator is specific to Sqlite3 and
-- is used to look for keywords in FTS3/4/5 tables.
match :: EntityField record Text -- ^ Field to filter on
-> Text -- ^ Text to compare with
-> Filter record -- ^ Resulting filter
match field val = Filter field (Left val) (BackendSpecificFilter "match")
It works fine but does not allow to use a very specific (strange?) feature of Sqlite3 FTS3/4 tables: you can specify the table name instead of just a column name. The effect is that the match operator will look for the searched terms in every column of the table.
It means you can write queries like:
SELECT *
FROM tablename
WHERE tablename MATCH "hello";
Such queries are described in the Sqlite3 FTS3/4 documentation https://sqlite.org/fts3.html#simple_fts_queries
Reading the Persistent documentation and the Filter definition, it might be possible to create this filter using a BackendFilter but I have not found any example of how actually using it.
What also puzzled me is the use of the type family BackendSpecificFilter which is used as a constructor in PersistFilter.
I would like to be able to write queries like:
mkPersist persistSettings [persist|
User
forename String
surname String
bio String
|]
users <- runDB $ selectList [ User `matchAll` searchedTerms ] []
Can someone show me the right way to use BackFilter in this case?
Thanks
From what I investigated, it is not possible to create a BackendFilter as easily as a BackendSpecificFilter. The first is meant to be interpreted specifically by the database layer meaning one would have to patch the persistent-sqlite package in order to allow what I described.

IDL: Accessing struct fields using field names stored in variables?

If I have a struct with a fieldname 'fieldname', is it possible to access the data in that field using only the variable?
ie.
x = 'fieldname'
is it possible to do
data = struct.(x) in some way? I want to use the string in x as the field name.
Yes, this is possible using the TAG_NAMES function:
tnames=TAG_NAMES(struct)
tindex=WHERE(STRCMP(tnames,'fieldname') EQ 1)
data=struct.(tindex)
The call to TAG_NAMES returns an array of strings representing the tags defined in struct.
The WHERE statement returns the index in tnames of a string matching 'fieldname'.
Finally, the index is passed to the struct.(tindex) operation, which extracts a field by
its numeric tag index.
Of course, in a real application you'd want to check whether tindex was successfully
matched to something, otherwise IDL will choke on the structure lookup with an index
of -1.

Resources