Usergrid fulltext search - apigee

I am using APIGEE (apigee.com ) usergrid js lib and I am new in this technology
I have make function for search record 'full text search' below is my code
brands.setQueryParams({"ql":"select * where brand contains '"+searchItem+"' " , "limit":'9999' });
brands.get(
function() {
//first empty out all the current brands in the list
$("#t_body").remove();
after calling this function url hit apigee server like below
api.usergrid.com//sandbox/brands?ql=select%20*%20where%20bran‌​d%20%20contains%20%27Sam%27%20&limit=9999
but not record found but we have record into database

The system doesn't support "full text search". You can, however, use wildcards. You have to postfix a "*" to the end of the string (won't work when the * is at the beginning or inside the string):
select * where brand contains 'foo*'
will match
{"brand":"foobar"}

Related

Netsuite - Check a box from a Saved Search button

Some progress made here thanks to answer from Suitestar.
Managed to make a suitelet which performs the task. However:
Only works by putting an absolute item ID in the script itself.
The var rec_ID to pull through the ID of the item from the search does not work. I get a 'Missing Argument' error.
Opens a blank window and the saved search page defaults to a blanket item search. I just want a popup to say 'Approved' and for the search to stay the same.
How do I pull through the field ID from the search as well?
Suite URL and code below:
<button onclick=window.open(/app/site/hosting/scriptlet.nl?script=602&deploy=1&rec_id=2958);>Approve
/**
* #NApiVersion 2.x
* #NScriptType Suitelet
* #NModuleScope SameAccount
*/
define (['N/record'], function (record) {
function onRequest(scriptContext) {
var rec_Id=scriptContext.request.parameters.rec_Id; //getting parameter
var itemRecObj= record.load({ type: record.Type.INVENTORY_ITEM, id: '2958', isDynamic:true });
itemRecObj.setValue({ fieldId: 'custitem_aamac_custom_approved', value: true });
itemRecObj.save();
}
return {
onRequest: onRequest
};
});
You can write a backend logic in suitelet script for checking the check box.
Load the record with internal id of item
Use setValue with value "true" for check box fieldID .
And then save the record.
deploy the suitelet in release mode, copy the external url put it in button onclick function.as in screenshot you did.
pass the parameter using &rec_Id something like this in the last of url
https://tstdrv1911674.extforms.netsuite.com/app/site/hosting/scriptlet.nl?script=6030&deploy=1&compid=TSTDRV1911674&h=e3ac9c7644c25b4dded1&rec_Id=
and get the parameter in suitelet script using
var rec_Id=scriptContext.request.parameters.rec_Id; //getting parameter
var itemRecObj= record.load({
type: record.Type.INVENTORY_ITEM,
id: rec_Id,
isDynamic:true
});
itemRecObj.setValue({
fieldId: 'checkboxfieldId',
value: true
});
itemRecObj.save();

how to get navigated to a custom record from a button with some field sourced?(suitescript 2.0)

i m doing this in my Client script which is being called by the function of UE script button.
var createEstimatorURL = url.resolveRecord({
recordType: 'customrecord_awt_estimator_hdr',
recordId: '',
isEditMode: true,
params: {
'project': project,
'customer': customer,
'createdBy': createdBy,
'projectStatus': projectStatus,
'subsid': subsid,
'awtEstRef': awtEstRef
}
});
After getting the URL from resolve record, I m doing newWindow = window.open(createEstimatorURL);
The record is getting opened in create mode (not saved yet), but how to source the fields that I sent as params? please help
They are in the request parameters of your context on the new page that opens.
You can use this bit
context.request.parameters['*'],
where * is the name of your parameter, to get them.

How to extract params from received link in react native firebase dynamiclink?

I tried to migrate from react navigation deeplinks to firebase dynamic linking using this library (react-native-firebase).
I have set up everthing and links are being generated and received on the app. However, is there any way to extract the params sent in the link properly using this library?. Currenty this is my code for handling received link:
handleDynamicLink = () => {
firebase
.links()
.getInitialLink()
.then((url) => {
console.tron.log('link is ', url);
})
.catch((error) => {
console.tron.log(error);
});
};
The url received is
https://links.dev.customdomain.in/?link=products%2F1122
I want to extract the product id 1122 from the url. The only way for me right now is to parse the string and manually extract the relevant params. Unlike in react navigation deeplinks where I used to specify the path, like
Product: {
screen: Product,
path: 'customdomain/products/:slug',
},
Where the slug or id data used to pass as navigation param in the respective screen. Am I missing something? How can I pass mutliple params this way?
Point 2 in this link here says:
The response contains the URL string only.
This means that the firebase.links().getInitialLink() method does not return query parameters, at least as at the time of writing this (v5.5.5). To add your paramaters, you should use a URL with your query param as part of the URL. What I mean is this
Use https://links.dev.customdomain.in/link/products/1122
and use Regex to extract the product id which is of interest to you. This is what works for me and I hope it helps.

How to pass a fresh _id from a method insert into a subscription/publication?

I have an app where you can choose (or add if they don't exist!) a superhero/villain character from a certain universe on the first page; then outfit him with weapons, clothes, and gadgets on the second page (build).
I have this route defined:
Router.route('/build/:character', {
name: 'build'
waitOn: Meteor.subscribe('characters', {name: this.params.character})
//and a few other subscriptions and sessions as well for the items
//and stuff, but those don't matter here.
}
The link from the specific character, though, passes along a query as well:
<a href="{{pathFor 'build' query=this.universe}}">
So the final link could look something like this:
/build/Aquaman?DCComics
Now the page you are on will display a list of weapons and gadgets where you could also add other stuff if you so wish. Then you are supposed to drag the items you want to include onto your version of this hero.
Problem is, at this point the app doesn't know you even want to create your own hero. Maybe the user is just looking through them for fun. There's a button that the user has to click first to initialize the creating process, and that's when the actual _id is created, something like this:
Meteor.methods({
buildHero: function(heroCharacterName, heroUniverse) {
var heroToAdd = {}
heroToAdd['characterName'] = heroCharacterName
heroToAdd['universe'] = heroUniverse
heroToAdd['_createdAt'] = new Date()
CreatedHeroes.insert(heroToAdd, function() {
if (! error)
//Update the subscription somehow...
})
}
})
So, the _id that is created here in the new Collection must be passed along to a subscription somehow, because I don't want the user to see other personal heroes that have been created, only his own newly created one.
The solution I have in mind is adding the _id onto the URL in form of a hastag, and use this.params.hash in the subscription like so:
Router.route('/build/:character', {
name: 'build'
waitOn: [Meteor.subscribe('characters', {name: this.params.character}),
Meteor.subscribe('createdheroes', this.params.hash)]
}
First of all, is this a valid approach? If so, how do I accomplish it; how do I actually update the URL to include this hash?
If not, what would be a better approach?
I think you have to handle this logic in the data context or in a template helper and not in the way of subscribing/publishing.
If I was you I would besure that the newly created item is being published and subscribed by the client and modify your search query just that it only adds the newly created item.
I am not sure if I understand your question well but what I got, you will know the last _id which was used on your insert.
Instead of letting done this automatically by meteor, just use the meteor method to create / get that _id value >> see Meteor Documentation
var new_id = new Mongo.ObjectID()
col1.insert({ _id: new_id, ... });
col2.insert({ ..., ref_col1_id: new_id, ... });

Tridion Query for component that have no exact metadata field

I have a components that based on schema that have a non mandatory metadata field ExtendedType. I can query for a component that have this field with a certain value:
new CustomMetaValueCriteria(new CustomMetaKeyCriteria("ExtendedType"), "Highlight", Criteria.Equal)))
I need to query for a components that have no this field filled in. How can I query for a that.
In SQL I can write next:
select * from t where t.ExtendedType IS NULL
How can i do this using Trdion Query? In common i need to implement query like:
select * from t where t.ExtendedType = "Highlight" OR t.ExtendedType IS NULL
You might be able to achieve this with the NotInCriteria, as follows:
new NotInCriteria
(
new CustomMetaValueCriteria
(
new CustomMetaKeyCriteria("ExtendedType"), "%", Criteria.Like
)
)
I haven't tested this, it's just a thought. Even if it works, be sure to check if it performs as well!
PS: next time, please use the tridion.stackexchange.com forum for Tridion-related questions!

Resources