Laravel/Eloquent, retrieve data dynamically (whereIn, sum) - laravel

I am pretty noob in Laravel, and I would like to retrieve data from DB in an "automated" way. I have a query that get the value of key "cases" where 'state' is the latest repeated
$pieWyoming=State::select('cases')->where('state', '=', 'Wyoming')->orderByDesc('id')->limit(1)->get()->sum('cases');
But I want to do this with whereIn
$statesArr = array("Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Guam", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virgin Islands", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
$Wyoming=State::select('cases')->whereIn('state',$statesArr)->orderByDesc('id')->limit(1)->get()->sum('cases');
But it seems that this traverse $statesArr and only gets the last value, that is correct but is only one value from one state, I want ALL VALUES from ALL states
EDIT, SAMPLE DATA AND EXPECTED OUTPUT
The database holds data as this https://res.cloudinary.com/dcdajhifi/image/upload/v1599003808/ex1_ys5ksi.png
and I would like to get only the value of field "cases" for each state in array $statesArr, each state should be the last repeated, in example
https://res.cloudinary.com/dcdajhifi/image/upload/v1599003808/ex2_lby8md.png
here is the last time ALABAMA appears, so I would like to get the value of cases for this row, THIS for each state. So I could create a pannel where I can display the state name with it's value cases and deaths, without doing a query for each state.

To pick the latest entry (based on latest autoincrement id) for each state you can do a self join with your table like
DB::table('states as a')
->select('a.*')
->leftJoin('states as b', function ($join) {
$join->on('a.state', '=', 'b.state')
->whereRaw(DB::raw('a.id < b.id'))
;
})
->whereNull('b.id')
->whereIn('a.state',$statesArr)
->get();
If you are using latest version of laravel you can rewrite above using inner join
$latestStates = DB::table('states')
->select(DB::raw('max(id) as max_id'))
->groupBy('state');
$states = DB::table('states as a')
->joinSub($latestStates, 'b', function ($join) {
$join->on('a.id', '=', 'b.max_id');
})->whereIn('a.state',$statesArr)
->get();
Or you can use whereExists
$states = DB::table('states as a')
->whereExists(function ($query) {
$query->select(DB::raw(1))
->from('states as b')
->whereRaw('a.state= b.state')
->groupBy('b.state')
->havingRaw('max(b.id) = a.id')
;
})->whereIn('a.state',$statesArr)
->get();

Try like this:
$statesArr = array("Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida", "Georgia", "Guam", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas","Kentucky","Louisiana","Maine","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Northern Mariana Islands", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Puerto Rico", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virgin Islands", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming");
$Wyoming = State::whereIn('state', $statesArr)->orderByDesc('id')->sum('cases');

Related

Get certain attribute data from the result of a recursive query

The following example is used to populate a tree and use a table with a parent_id column.
The data is obtained with a recursive query.
$data = [{
"id": 1,
"name": "parent 1"
"note": "note 1",
}, {
"id": 2,
"name": " parent 2",
"note": "note 2",
"children": [{
"id": 21,
"name": "child A of 2",
"note": "note A of 2",
},{
"id": 22,
"name": "child B of 2",
"note": "note B of 2",
},{
"id": 23,
"name": "child C of 2",
"note": "note C of 2",
"children": [{
"id": 231,
"name": "child A of 23",
"note": "note A of 23",
"children": [{
"id": 2311,
"name": "child A of 231",
"note": "note A of 231",
"children": []
}]
}]
}]
}];
And the query:
$myData= Hierarchy::whereNull('parent_id')
->with('children')
->get();
So far so good.
Problem to solve:
It is necessary to obtain a simple (non-hierarchical) list of the id and name attributes of the parents and children.
Example:
"id": 1,
"name": "parent 1",
"id": 2,
"name": " parent 2",
"id": 21,
"name": "child A of 2",
"id": 23,
"name": "child C of 2",
"id": 231,
"name": "child A of 23",
"id": 2311,
"name": "child A of 231"
While this can be solved on the client side with javascript, I intended to do it with eloquent or PHP functions.
I made some attempts with the array_walk() and array_walk_recursive() PHP functions (without success).
Is there any way to solve with eloquent, bearing in mind that the number of children nodes can be infinite?
Thanks.
EDITED:
Example attempt with array_walk_recursive() PHP function
public function getList()
{
$myData= Hierarchy::whereNull('parent_id')
->with('children')
->get();
$data = array_walk_recursive($myData, "self::myFunction");
return response()->json(['success' => true, "data" => $data]);
}
public function myFunction($item, $key){
???
}
You can use the API Resouce recursively or use the recursive function to generate the hierarchy array.
Example with recursive function:
function makeHierarchy($values)
{
$result = [];
foreach($values as $item) {
$result[] = [
'id' => $item->id,
'name' => $item->name,
'children' => makeHierarchy($item->children),
];
}
return $result;
}
$values = Hierarchy::whereNull('parent_id')->with('children')->get();
$hierarchical = makeHierarchy($values);
If you want to get all values as a flat list:
$values = Hierarchy::get();
$result = [];
foreach($values as $item) {
$result[] = [
'id' => $item->id,
'name' => $item->name,
];
}
# now the result contains all the parents and children in a flat list
In the cleaner way:
$result = Hierarchy::select(['id', 'name'])->all();

How to apply distinct in payment_user_history.sid

Here is my results in postman
and i want to show only one sid even if have 2 in results
'''
"results": [
{
"sid": 2,
"id": 2,
"user_id": "S01202100002",
"name": "FRANK AMPLE WALKER",
"LRN": null,
"grade_level": 1
},
{
"sid": 2,
"id": 4,
"user_id": "S01202100002",
"name": "FRANK AMPLE WALKER",
"LRN": null,
"grade_level": 1
},
{
"sid": 3,
"id": 3,
"user_id": "S01202100003",
"name": "NEIL DEST MORGAN",
"LRN": null,
"grade_level": 2
}
]
}
here is my code
public function billingpaymentaccount(){
$fetch = DB::table('payment_user_history')
->leftJoin('tbl_accounts', 'payment_user_history.sid', '=', 'tbl_accounts.id')
->leftJoin('tbl_enrollment', 'payment_user_history.sid', '=', 'tbl_enrollment.student_id')
->select('payment_user_history.sid','payment_user_history.id', 'tbl_accounts.user_id',
DB::raw('concat(tbl_accounts.first_name, " ", tbl_accounts.middle_name, " ",
tbl_accounts.last_name) as name'), 'tbl_accounts.LRN', 'tbl_enrollment.grade_level')
->where('tbl_accounts.account_types',10)
->get();
return response()->json(['results' => $fetch], 200);
}
You can use the ->distinct() modifier to return unique rows. However, payment_user_history.id needs to be removed from your select statement for the query to only return one row per sid.
// note the added distinct
$fetch = DB::table('payment_user_history')->distinct()
->leftJoin('tbl_accounts', 'payment_user_history.sid', '=', 'tbl_accounts.id')
->leftJoin('tbl_enrollment', 'payment_user_history.sid', '=', 'tbl_enrollment.student_id')
// note the removed payment_user_history.id
->select('payment_user_history.sid', 'tbl_accounts.user_id', DB::raw('concat(tbl_accounts.first_name, " ", tbl_accounts.middle_name, " ", tbl_accounts.last_name) as name'), 'tbl_accounts.LRN', 'tbl_enrollment.grade_level')
->where('tbl_accounts.account_types',10)
->get();
If you need to keep the payment_user_history.id field, then you have to decide how to aggregate it to one row (e.g., using the max or min and a group by clause).

Returning Specific Columns with SUM & COUNT from Collection of Relations

I have Models Product, ProductVariant, and Department
Department:
id | name | ....
Product:
id | name | sku | department_id | ....
ProductVariant:
id | product_id | quantity | ....
And all associated with each other like:
Relationship products: Department hasMany Products
Relationship department: Product belongsTo Department
Relationship variants: Product hasMany ProductVariants
Relationship product: Product belongsTo Product
Everything works as expected between relations over Eloquent calls
Now, using Eloquent I'm trying to retrieve a collection of following columns:
product.id | product.name | product.variant_count | product.stock | department.name
By product.stock I mean: $product->variants->sum('quantity'), but I'm having hard time getting SUM inside with() method
What I've tried so far:
$products = Product::select('id', 'name', 'sku', 'department_id') //gives product.name, sku, etc
->withCount('variants') //gives product.variants_count
->with(['variants' => function($query) {
$query->select('id', 'product_id', 'quantity'); //gives variants->each.quantity
}])
->with(['department' => function($query) {
$query->select('id', 'name'); //gives department.name
}]);
This code gives something like this:
[
{
"id": "2",
"name": "Letv LU50609 Earphone - Grey",
"sku": "PT-00002",
"department_id": "2",
"variants_count": "1",
"variants": [
{
"id": "2",
"product_id": "2",
"quantity": "35"
}
],
"department": {
"id": "2",
"name": "Phones & Tabs Accessories"
}
},
{
"id": "3",
"name": "MI In-Ear Headphones Basic 3.5mm HSEJ03JY",
"sku": "PT-00003",
"department_id": "2",
"variants_count": "5",
"variants": [
{
"id": "3",
"product_id": "3",
"quantity": "9"
},
{
"id": "4",
"product_id": "3",
"quantity": "9"
},
{
"id": "5",
"product_id": "3",
"quantity": "10"
},
{
"id": "6",
"product_id": "3",
"quantity": "7"
},
{
"id": "7",
"product_id": "3",
"quantity": "7"
}
],
"department": {
"id": "2",
"name": "Phones & Tabs Accessories"
}
}
]
But what I want to achieve is:
[
{
"id": "2",
"name": "Letv LU50609 Earphone - Grey",
"sku": "PT-00002",
"variants_count": "1",
"stock": "35",
"department": "name": "Phones & Tabs Accessories"
},
{
"id": "3",
"name": "MI In-Ear Headphones Basic 3.5mm HSEJ03JY",
"sku": "PT-00003",
"variants_count": "5",
"stock": "42",
"department": "name": "Phones & Tabs Accessories"
}
]
How can I achieve this???
Option 1
You could map() the collection before return it:
$products = Product::select('id', 'name', 'sku', 'department_id')
->withCount('variants')
->with(['variants', 'department'])
->get()
->map(function ($product){
return [
'id' => $product->id,
'name' => $product->name,
'sku' => $product->sku,
'variants_count' => $product->variants_count,
'stock' => $product->variants->sum('quantity'),
'department' => $product->department->name
];
});
Option 2
Using API Resources. Let me know if you need help in this aspect.
What about using the query builder something like this:
DB::table('products as product')
->select([
'product.id',
'product.name',
DB::raw('count(pv.id) as variant_count'),
DB::raw('sum(pv.quantity) as stock'),
'department.name'
])
->join('department', 'product.department_id', '=', 'department.id')
->join('product_variants as pv', 'product.id', '=', 'pv.id')
->get();
Not sure if this will work exactly like this, but it should give you a path.
you can access your required result with this query by checking your database tables
SELECT
products.*,
SUM(variants.available) AS stock,
COUNT(variants.id) as count,
department.name as department
FROM
products
LEFT JOIN variants ON products.id = variants.product_id
LEFT JOIN department ON products.department_id= department.id
GROUP BY
products.id
What you are looking for can be achieved in many ways. The ideal solution will build the sum within the database for best performance. To achieve so, you can use a custom query together with the Laravel query builder as already explained by #nakov or you use a little exploit of the Eloquent relationship system:
$products = Product::query()
->join('departments', 'departments.id', '=', 'products.department_id)
->withCount('variants as variant_count')
->withCount(['variants as stock' => function ($query) {
$query->selectRaw('SUM(quantity)'); // this may look weird but works
})
->select([
'products.id',
'products.name',
'departments.name as department',
])
->get();

CosmosDB - SubDocument Delselecting - LINQ Query

I have a ProductDocument model in CosmosDB, which represents a Product. Within that model there is a subdocument contributors which holds who has contributed to the Product. Each contributor has a role.
Now I have been experimenting with a query that needs to:
Only select ProductDocument with a contributor.roleDescription of Author
Only select ProductDocument with a division of Pub 1
Only include contributors sub documents with a contributor.roleDescription of Author in the result set.
Now I'm struggling with:
Part 3 of select above. How do I accomplish this bit as my result set is including both contributor.roleDescription of Author AND Illustrator
Example Cosmos Model:
[
{
"id": "1",
"coverTitle": "A Title",
"pubPrice": 2.99,
"division" :"Pub 1",
"Availability": {
"code": "20",
"description": "Digital No Stock"
},
"contributors": [
{
"id": 1,
"firstName": "Brad",
"lastName": "Smith",
"roleDescription": "Author",
"roleCode": "A01"
},
{
"id": 2,
"firstName": "Steve",
"lastName": "Bradley",
"roleDescription": "Illustrator",
"roleCode": "A12"
}
]
},
{
"id": "2",
"coverTitle": "Another Title",
"division" :"Pub 2",
"pubPrice": 2.99,
"Availability": {
"code": "50",
"description": "In Stock"
},
"contributors": [
{
"id": 1,
"firstName": "Gareth Bradley",
"lastName": "Smith",
"roleDescription": "Author",
"roleCode": "A01"
}
]
}]
Here is my SQL which I have been playing around with in the Data Explorer:
SELECT VALUE p
FROM Products p
JOIN c IN p.contributors
WHERE c.roleDescription = 'Author'
AND p.division = 'Pub 1'
Here is my LINQ query from my service:
var query = client.CreateDocumentQuery<ProductDocument>(
UriFactory.CreateDocumentCollectionUri("BiblioAPI", "Products"),
new FeedOptions
{
MaxItemCount = -1,
EnableCrossPartitionQuery = true
}
)
.SelectMany(product => product.Contributors
.Where(contributor => contributor.RoleDescription == "Author")
.Select(c => product)
.Where(p => product.Division == "Pub 1"))
.AsDocumentQuery();
List<ProductDocument> results = new List<ProductDocument>();
while (query.HasMoreResults)
{
results.AddRange(await query.ExecuteNextAsync<ProductDocument>());
}
It selects the correct records, but how do I de-select the Illustrator sub document of contributor, because at the moment I get the following:
{
"id": "1",
"coverTitle": "A Title",
"pubPrice": 2.99,
"division" :"Pub 1",
"Availability": {
"code": "20",
"description": "Digital No Stock"
},
"contributors": [
{
"id": 1,
"firstName": "Brad",
"lastName": "Smith",
"roleDescription": "Author",
"roleCode": "A01"
},
{
"id": 2,
"firstName": "Steve",
"lastName": "Bradley",
"roleDescription": "Illustrator",
"roleCode": "A12"
}
]
}
But the following output is what I want, excluding the Illustrator contributor sub document:
{
"id": "1",
"coverTitle": "A Title",
"pubPrice": 2.99,
"division" :"Pub 1",
"Availability": {
"code": "20",
"description": "Digital No Stock"
},
"contributors": [
{
"id": 1,
"firstName": "Brad",
"lastName": "Smith",
"roleDescription": "Author",
"roleCode": "A01"
}
]
}
EDIT:
I would like to filter on Product if one of the subdocument contributor.roleDescription equals Author. So if the Product record doesn't include a Author contributor I don't want it
I want to include each contributor subdocument that equals Author. So if there are multiple Author contributor subdocuments for a Product, I want to include them, but exclude the Illustrator ones.
You could have a Collection of ProductDocuments.
Help on the fluent LINQ syntax would help greatly.
Azure CosmosDB now supports subqueries. Using subqueries, you could do this in two ways, with minor differences:
You could utilize the ARRAY expression with a subquery in your projection, filtering out contributors that you don’t want, and projecting all your other attributes. This query assumes that you need a select list of attributes to project apart from the array.
SELECT c.id, c.coverTitle, c.division, ARRAY(SELECT VALUE contributor from contributor in c.contributors WHERE contributor.roleDescription = "Author") contributors
FROM c
WHERE c.division="Pub 1"
This assumes that you need to filter on division "Pub 1" first followed by the subquery with the ARRAY expression.
Alternately, if you want the entire document along with the filtered contributors, you could do this:
SELECT c, ARRAY(SELECT VALUE contributor from contributor in c.contributors WHERE contributor.roleDescription = "Author") contributors
FROM c
WHERE c.division="Pub 1"
This will project the original document with a "Pub 1" division in the property labeled "c", along with a filtered contributor array separately in the property labeled "contributors". You could refer this contributor array for your filtered contributors and ignore the one in the document.
This will do what you want, but obviously if you have multiple contributors you want to show it might not do quite what you are after - it's hard to tell with your question if that is what you want exactly
SELECT p.id, p.coverTitle, p.pubPrice, p.division, p.Availability, c as contributors
FROM Products p
JOIN c IN p.contributors
WHERE c.roleDescription = 'Author'
AND p.division = 'Pub 1'
and the output is:
[
{
"id": "1",
"coverTitle": "A Title",
"pubPrice": 2.99,
"division": "Pub 1",
"Availability": {
"code": "20",
"description": "Digital No Stock"
},
"contributors": {
"id": 1,
"firstName": "Brad",
"lastName": "Smith",
"roleDescription": "Author",
"roleCode": "A01"
}
}
]
Note that contributors is not a list, it's a single value, so if multiple contributors match the filter, then you will get the same product returned multiple times.

why AutoComplete Extender work very slow ASP.NET

Fixed:
Missing Property CompletionInterval="0"
I am testing functionalities of ajax autocomplete extender and webservices. And found that auto complete extender take a while to fetch the data and display. I don't have database connection or anything like that at the moment. I am just putting all the items in a array in the webservice function and return the matching set of items using LINQ. There is about 1 second gap showing the data. I tried turned on/off EnableCaching which I found someone suggested that on a blog but it still very slow comparing how Google searches billions of data and returns you the result on the live website with billions of users without a fraction of a second delay.
Although Google won't use asp.net, Linq or script manager to do Ajax work, I am just testing on my local computer, with no database connection, I assume there must be a way to make it work faster. Probably I missed to set a setting somewhere. Here is my code.
aspx
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>
<asp:TextBox ID="TextBox1" runat="server" Width="200px"></asp:TextBox>
<asp:AutoCompleteExtender ID="TextBox1_AutoCompleteExtender" runat="server" ServiceMethod="HelloWorld" MinimumPrefixLength="1" EnableCaching="false" CompletionListCssClass="CompletionListCssClass"
DelimiterCharacters="" Enabled="True" ServicePath="WebService.asmx" TargetControlID="TextBox1">
</asp:AutoCompleteExtender>
<br />
<asp:Button ID="Button1" runat="server" Text="Search" />
There is nothing on code_behind.
Here is code for webservice ..
<System.Web.Script.Services.ScriptService()> _
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld(prefixText As String) As String()
Dim str() As String = {"Afghanistan", "Albania", "Algeria", "Andorra", "Angola", "Antigua and Barbuda", "Argentina", "Armenia", "Australia", "Austria", "Azerbaijan",
"Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bhutan", "Bolivia", "Bosnia and Herzegovina", "Botswana", "Brazil", "Brunei",
"Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Central African Republic",
"Chad", "Chile", "China", "Colombi", "Comoros", "Congo (Brazzaville)", "Congo", "Costa Rica", "Cote d'Ivoire", "Croatia", "Cuba", "Cyprus",
"Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor (Timor Timur)", "Ecuador", "Egypt", "El Salvador",
"Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Fiji", "Finland", "France", "Gabon", "Gambia, The", "Georgia", "Germany", "Ghana",
"Greece", "Grenada", "Guatemala", "Guinea", "Guinea-Bissau", "Guyana", "Haiti", "Honduras", "Hungary", "Iceland", "India", "Indonesia",
"Iran", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati", "Korea, North",
"Korea, South", "Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libya", "Liechtenstein", "Lithuania",
"Luxembourg", "Macedonia", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania", "Mauritius",
"Mexico", "Micronesia", "Moldova", "Monaco", "Mongolia", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepa", "Netherlands",
"New Zealand", "Nicaragua", "Niger", "Nigeria", "Norway", "Oman", "Pakistan", "Palau", "Panama", "Papua New Guinea", "Paraguay",
"Peru", "Philippines", "Poland", "Portugal", "Qatar", "Romania", "Russia", "Rwanda", "Saint Kitts and Nevis", "Saint Lucia", "Saint Vincent",
"Samoa", "San Marino", "Sao Tome and Principe", "Saudi Arabia", "Senegal", "Serbia and Montenegro", "Seychelles", "Sierra Leone", "Singapore",
"Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "Spain", "Sri Lanka", "Sudan", "Suriname", "Swaziland", "Sweden", "Switzerland",
"Syria", "Taiwan", "Tajikistan", "Tanzania", "Thailand", "Togo", "Tonga", "Trinidad and Tobago", "Tunisia", "Turkey", "Turkmenistan", "Tuvalu", "Uganda",
"Ukraine", "United Arab Emirates", "United Kingdom", "United States", "Uruguay", "Uzbekistan", "Vanuatu", "Vatican City", "Venezuela", "Vietnam",
"Yemen", "Zambia", "Zimbabwe"}
Dim result As ArrayList = Nothing
Dim query = From x In str
Where x.ToLower.Contains(prefixText)
Select x
Return query.ToArray
End Function
End Class
Isn't there a delay property in the AutoCompleteExtender? CompletionInterval I think.
The right method is to add CompletionInterval="xxx" where xxx is the timeout in milliseconds. (Tools is my definition for ajaxtools)
<asp:TextBox runat="server" ID="Search" CssClass="search" AutoPostBack="true" />
<Tools:AutoCompleteExtender
ID="Search_AutoCompleteExtender"
runat="server"
CompletionInterval="250"
MinimumPrefixLength="3"
DelimiterCharacters=""
ServiceMethod="GetCompletionKeyList"
ServicePath="Keys.Aspx"
Enabled="True"
CompletionListCssClass="CompletionListCssClass"
CompletionListItemCssClass="CompletionListItemCssClass"
CompletionListHighlightedItemCssClass="CompletionListHighlightedItemCssClass"
TargetControlID="Search"/>
on the code VB behind
<System.Web.Services.WebMethod>
<System.Web.Script.Services.ScriptMethod()>
Public Shared Function GetCompletionKeyList(prefixText As String, count As Integer) As String()
return {"Your", prefixText, "selection" }
end Function

Resources