Suite nlapiSearchRecord adding filters via UI and code - suitescript

is it possible to add filters in both the UI and a suitescript 1 function and use them in combination?
Im doing a search for items and would like to limit the search results by the criteria set in the UI but also add parameters into the suitescript code

Yes, it is possible. You can use nlobjSearch.addFilter(newFilter); after loading the search object.

Related

How to restrict/customize the Resource Group Region in ARM templates

When we deploy a Custom template in Azure then a few parameters like Resource Group and Region are automatically popped up in the Azure portal (see the attached screenshot). I want to know how can we customize or restrict the list of regions using ARM templates.
Edit
The first "region" dropdown is for the resourceGroup's location - it's required when creating a new one, disabled when using an existing one. For a custom template, you cannot customize or remove that control unless you provide your own ui definition file.
That said, there's also nothing that requires you to use the value from that control in your deployment. If you want to use that value you'd reference it using resourceGroup().location in your template. That would allow you to remove the "duplicate" but also requires that the resources are deployed to the same region as the resourceGroup.
For your own "region" control, you can use the allowedValues property on the parameter in the template and that will restrict the items in the list to what you provide - that's the link that Jim provided in the comment above.
If you supply your own ui definition file there are more things you can do to restrict the list, but requires you to write a bit more code. This would be the starting point:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/managed-applications/create-uidefinition-overview
The docs talk about managedApplications, but the ui is a generic construct that you can use for template deployments, here's a generic example:
https://github.com/Azure/azure-quickstart-templates/tree/master/100-marketplace-sample
[edits post comment]
If you want to leverage the "built-in" region control you can customize the list of locations that appear there by setting the config in the createUiDefintion.json file. More on that here:
https://learn.microsoft.com/en-us/azure/azure-resource-manager/managed-applications/create-uidefinition-overview#config

How to get data once on WordPress page template and access it across multiple shortcodes that are used in same page

Have a requirement to create a WordPress dynamically based on multiple apis data, And we want to use that response data chunks as short code in page builder while designing backed with template.
We want to retrieve data only once in page template and how to make it available something $post without having to fetch on each short code.
Ex: $system_data -> which might contain name, description, performance etc, more attributes
And want to make common short code which takes attribute and get the relevant information.
[system-data attr="performance"]
What is the best way to achieve this, without loading whole data on each short code
you can use global variable to store data from first short code and use in other short code for entire page but you should check value is empty or not in every short code before use it

Algolia - WordPress - how can I get the actual query into JS variable to work with it further in the hits template?

I would like to do some interesting stuff with the hits that are being displayed based on the search query that user is not only typing into search box but actually filtering using the instant search filters. I have filter based on hierarchical events_location taxonomy. Based on what user selected I would get the info in JS variable that I can then further use to do other operations in the hits div, specifically on each hit card.
So my URL when searching updates like this:
/what-to-see/?q=&idx=sdbeta_posts_events&p=0&hFR%5Btaxonomies_hierarchical.events_calendar.lvl0%5D%5B0%5D=JUL%204&hFR%5Btaxonomies_hierarchical.events_category.lvl0%5D%5B0%5D=All&hFR%5Btaxonomies_hierarchical.events_locations.lvl0%5D%5B0%5D=Paddock%20Stage
I could potentially take the URL and extract the data from it, but I am sure there is more elegant way of working with the query.
In InstantSearch.js, the state is managed by another library called the algoliasearch-helper. Through this library you can read and write the search parameters.
The cleanest to access the helper is to build a custom widget, which is a plain object with lifecycle hooks (initial rendering and the other renderings). You can read more about custom widgets there.
Once you've accessed the helper, you can read and write with the helper API.
This can be found under search.searchParameters
So:
console.log(search.searchParameters);
Will give you whole object that you can then work with.
There is however one issue with this and that is that it works only on initial load. I was unable to make this work or get any data after starting to selecting categories. So if anyone knows how to use this so it updates after each selection please comment bellow.

Use custom value on symfony2 choice form type using choice_list

I'm trying to use custom values in a choice form type which gets its data from a database query that needs post-processing. For this reason I opted to use the choice_list option and extending Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList\ChoiceList. The problem is that I need custom index/value for the resulting dropdown instead of the default 0-indexed style. 0-index doesn't work form me as I will access the values using Javascript and need the data I retrieved from the database.
I already tried replacing the createIndex() method in the ChoiceList class but to no avail :-(
Any tips?
I can't believe it...I have tried the whole day and couldn't find the answer. 5 Minutes after having published the question, I solved it.
For future research:
You need to overwrite the createValue() method in the Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList class.

Flex, filter tree using ITreeDataDescriptor without reload and close all nodes

working with flex 4 and implementing filtering using ITreeDataDescriptor.
Filtering worked as expected like the following code snippet
however, i am trying to create a on-demand type of filter where user would type in the search clause in a TextInput, and as the user types, the tree nodes would be filtered on the fly.
my implementation now is have user click on the search button and then reapply the dataDescriptor then reload the data. A big problem is that the whole tree collapses after setting the dataProvider again.
any suggestion on how the on-demand filter can be achieved?
var dataFilter:ServicePricingFilter = new MyFilter();
dataFilter.searchString = this.txtSearchKeyword.text;
this.treeService.dataDescriptor = new MyDataDescriptor(dataFilter);
this.treeService.dataProvider = getTreeData();
I think you shouldn't set the dataprovider every time but use insted the filterFunction property available for ListCollectionView classes (ArrayCollection, XMLListCollection,...)
looked at the post Florian mentioned.
on-demand filtering is done by using ITreeDataDescriptor and a filterFunction.
on keyup event of the search TextInput, call invalidateList() function on the tree.
see the source code provided for the following post
http://www.davidarno.org/2009/04/01/how-to-filter-all-nodes-of-a-flex-tree-component/

Resources