Need some help here..have been stuck for awhile.
List all Name, Company Name of clients who have applied more than 2 loans which has a yearly repayment plan.
I should get 3 outputs:
John Tan, Happy Food Industry Pte Ltd
Mary Lee, Nice Man Advertising Pte Ltd
Yuyu Lee, NAGM Tuition Centre
My dataset:
[
{
"name": "John Tan",
"contact_number": [
"81726351",
"92019283",
"90192837"
],
"company_name": "Happy Food Industry Pte Ltd",
"company_registration_number": 950001819,
"type_of_ownership": "owner",
"last_roll_call": "16-06-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "01-12-21",
"financial_year_ended": "30-06-21",
"profit_and_lost_as_on_last_closing": 8000,
"cumulative_profit_and_lost_as_on_last_closing": 50000,
"loan_applied": [
"Purchase of delivery lorry",
"Renovation of tuition centre"
],
"commission_date": "01-12-19",
"loan_duration_in_mths": 24,
"interest_rate": 3,
"repayment_plan": "yearly",
"loan_amount": 138058298,
"status": "Requesting for delay payments",
"other_notes": null
},
{
"name": "Mary Lee",
"contact_number": [
"95213355"
],
"company_name": "Nice Man Advertising Pte Ltd",
"company_registration_number": 960087657,
"type_of_ownership": "Partner with 50% holding",
"last_roll_call": "15-06-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "Dec 21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 9000,
"cumulative_profit_and_lost_as_on_last_closing": 40000,
"loan_applied": [
"Purchase of crane",
"Purchase of machinery from USA"
],
"commission_date": "01-11-19",
"loan_duration_in_mths": 23,
"interest_rate": 4,
"repayment_plan": "yearly",
"loan_amount": 1237162,
"status": "Healthy",
"other_notes": null
},
{
"name": "Yuyu Lee",
"contact_number": [
"928371623"
],
"company_name": "NAGM Tuition Centre",
"type_of_ownership": "Partner with 20% holding",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "12-12-21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 1000000,
"cumulative_profit_and_lost_as_on_last_closing": 3002000,
"loan_applied": [
"Purchase of raw material from China",
"Renovation of shopping mall"
],
"commission_date": "01-11-19",
"loan_duration_in_mths": 11,
"interest_rate": 4,
"repayment_plan": "yearly",
"loan_amount": 918272,
"status": "Completed",
"other_notes": null
},
{
"name": "Joseph Lee",
"contact_number": [
"918273615",
"0192837176",
"1827361923"
],
"company_name": "Akaka Tuition Centre",
"company_registration_number": 929381782,
"type_of_ownership": "Director",
"last_roll_call": "15-11-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "No",
"plan_next_call": null,
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 999999,
"cumulative_profit_and_lost_as_on_last_closing": 9000,
"loan_applied": "Purchase of delivery lorry",
"commission_date": "01-11-19",
"loan_duration_in_mths": 11,
"interest_rate": 4,
"repayment_plan": "monthly",
"loan_amount": 918272,
"status": "Completed",
"other_notes": null
},
{
"name": "Tan Meh Meh",
"contact_number": [
"92837162",
"9189278371"
],
"company_name": "Target Pte Ltd",
"company_registration_number": 293891823,
"type_of_ownership": "Director",
"last_roll_call": "15-12-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "09-12-21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 12500000,
"cumulative_profit_and_lost_as_on_last_closing": 1500000,
"loan_applied": "Purchase of delivery lorry",
"commission_date": "01-11-19",
"loan_duration_in_mths": 55,
"interest_rate": 4,
"repayment_plan": "monthly",
"loan_amount": 918272,
"status": "Completed",
"other_notes": null
},
{
"name": "Teo Bee Bee",
"contact_number": [
"92039189278",
"192838182",
"192837172"
],
"company_name": "Hello Kitty Pte Ltd",
"company_registration_number": 102039192,
"type_of_ownership": "Owner",
"last_roll_call": "13-11-21",
"follow_up_notes": "Do not require any loan at this moment",
"need_to_follow_up": "Yes",
"plan_next_call": "09-01-21",
"financial_year_ended": "30-01-21",
"profit_and_lost_as_on_last_closing": 6000,
"cumulative_profit_and_lost_as_on_last_closing": 24000000,
"loan_applied": "Purchase of delivery lorry",
"commission_date": "01-11-19",
"loan_duration_in_mths": 33,
"interest_rate": 4,
"repayment_plan": "monthly",
"loan_amount": 2312333,
"status": "Requesting for delay payments",
"other_notes": null
}
]
The following query will get you what is needed.
db.collection.find( { "loan_applied.1": { "$exists": true }, "repayment_plan": "yearly" } , {"name":1, "company_name": 1} );
Explanation:
Since loan_applied is an array field, we can use the dot notation to see if any element exist after the index 1, which means more than 1 element. We add one more filter for repayment_plan.
In the second part of the query, we use projection to return back only name and company_name.
Related
How can I determine currencies by country? I am receiving payment transaction using Pay with Flutter plugin.
How can I make the following values in USD for America and TRY for Turkey according to the user's country.
"countryCode": "US",
"currencyCode": "USD",
const String defaultApplePay = '''{
"provider": "apple_pay",
"data": {
"merchantIdentifier": "merchant.com.sams.fish",
"displayName": "Sam's Fish",
"merchantCapabilities": ["3DS", "debit", "credit"],
"supportedNetworks": ["amex", "visa", "discover", "masterCard"],
"countryCode": "US",
"currencyCode": "USD",
"requiredBillingContactFields": ["emailAddress", "name", "phoneNumber", "postalAddress"],
"requiredShippingContactFields": [],
"shippingMethods": [
{
"amount": "0.00",
"detail": "Available within an hour",
"identifier": "in_store_pickup",
"label": "In-Store Pickup"
},
{
"amount": "4.99",
"detail": "5-8 Business Days",
"identifier": "flat_rate_shipping_id_2",
"label": "UPS Ground"
},
{
"amount": "29.99",
"detail": "1-3 Business Days",
"identifier": "flat_rate_shipping_id_1",
"label": "FedEx Priority Mail"
}
]
}
}''';
I tried to do it with the codes in the getCurrency() method above, but it adjusts according to the device language. Idont want this.
String getCurrency() {
//var format = NumberFormat.simpleCurrency(locale: Platform.localeName);
Locale myLocale = Localizations.localeOf(context);
return myLocale.countryCode ?? "";
}
when creating a product in Shopify via the REST API, adds a default option and variant like below
"options": [
{
"id": 9651869188247,
"product_id": 7644173172887,
"name": "Title",
"position": 1,
"values": [
"Default Title"
]
}
]
Variants:
{
"variants": [
{
"id": 42211487744151,
"product_id": 7644173172887,
"title": "Default Title",
"price": "1.00",
"sku": "",
"position": 1,
"inventory_policy": "deny",
"compare_at_price": null,
"fulfillment_service": "manual",
"inventory_management": "shopify",
"option1": "Default Title",
"option2": null,
"option3": null,
"created_at": "2022-06-17T17:18:24+05:30",
"updated_at": "2022-06-17T17:18:24+05:30",
"taxable": true,
"barcode": null,
"grams": 0,
"image_id": null,
"weight": 0.0,
"weight_unit": "kg",
"inventory_item_id": 44310083534999,
"inventory_quantity": 0,
"old_inventory_quantity": 0,
"requires_shipping": true,
"admin_graphql_api_id": "gid://shopify/ProductVariant/42211487744151"
}
]
}
I want to update the existing Option and Variants of a product to show "Color" & "Size" as options and variants of them. For that I tried the Shopify Rest API but that still is raising the below error
request model:
{
"variant": {
"product_id": 7644173172887,
"option1": "red",
"option2": "small",
"price": "1.0",
"title": "S"
}
}
response :
{
"errors": {
"base": [
"Option values provided for 1 unknown option(s)"
]
}
}
You are not specifing what endpoint you're using but I can see that you're specifing the Product Id and that should not be the case. If you need to add a new variant this is the request you should do
POST https://yourstore.myshopify.com/admin/api/2022-04/products/7644173172887/variants.json
{"variant":{"option1":"Red", "option2" :"Small", "title": "Red", "price":"1.00"}}
You will also need to update the current "Default Title" variant (I suggest, if possible to create the product with a valid variant).
PUT https://yourstore.myshopify.com/admin/api/2022-04/variants/42211487744151.json
{"variant":{"id":42211487744151,"option1":"Red","option2" : "S", "price":"99.00", "title" : "Red"}}
I want to build a query when i send username to server so i can exclude the record has the excludeUsers has the same username i sent.
Here is my data : `
"id": "f4830220-9912-4cbb-b685-edf4aaaf8fd5",
"createdAt": "2022-03-24T10:19:48.096Z",
"updatedAt": "2022-03-24T10:26:42.487Z",
"isDeleted": false,
"username": "vietphuongthoa98",
"link": "",
"type": "follow",
"current": 13456,
"target": 13556,
"totalPurchase": 100,
"purchasedPacks": [
{
"id": "fbb3079b-32c9-4c4b-a297-16741d1f5485",
"name": "Some packets",
"type": "follow",
"count": 2,
"price": 100,
"follows": 50,
"createdAt": "2022-03-23T07:18:22.898Z",
"isDeleted": false,
"updatedAt": "2022-03-23T09:49:30.192Z",
"description": "Some packages description.",
"originPrice": 0
}
],
"excludeUsers": [
{
"id": "9d8c25d2-8f03-46b3-92fa-b9489b943a56",
"deviceName": "iPhone 12 Pro Max",
"username": "hoaa.hanassii",
"platform": "ios",
"timeZone": 0,
"deviceAge": 21,
"subscribed": true,
"coins": 19600,
"subscriptionExpiration": "2022-04-27T00:00:00.000Z",
"isBlocked": false
}
]
Here is my query builder :
queryBuilder
.leftJoin('featured_user.excludeUsers', 'excludeUsers')
.andWhere('excludeUsers.username != :username', {
username: filter.username,
});
The actual query result is :
SELECT "featured_user"."id" AS "featured_user_id",
"featured_user"."tenant_id" AS "featured_user_tenant_id",
"featured_user"."created_at" AS "featured_user_created_at",
"featured_user"."updated_at" AS "featured_user_updated_at",
"featured_user"."is_deleted" AS "featured_user_is_deleted",
"featured_user"."username" AS "featured_user_username",
"featured_user"."link" AS "featured_user_link",
"featured_user"."type" AS "featured_user_type",
"featured_user"."current" AS "featured_user_current",
"featured_user"."target" AS "featured_user_target",
"featured_user"."total_purchase" AS "featured_user_total_purchase",
"featured_user"."purchased_packs" AS "featured_user_purchased_packs",
"featured_user"."user_id" AS "featured_user_user_id",
"excludeUsers"."username" AS "excludeUsers_username",
"excludeUsers"."id" AS "excludeUsers_id"
FROM "featured_users" "featured_user"
LEFT JOIN "featured_users_exclude_users_users" "featured_user_excludeUsers" ON "featured_user_excludeUsers"."featured_users_id"="featured_user"."id"
LEFT JOIN "users" "excludeUsers" ON "excludeUsers"."id"="featured_user_excludeUsers"."users_id"
WHERE "excludeUsers"."username" != $1 -- PARAMETERS: ["hoaa.hanassii"]
The problem is nothing response. Any ideal ? Thanks
can you add getMany() end of querybuilder and try
queryBuilder
.leftJoin('featured_user.excludeUsers', 'excludeUsers')
.andWhere('excludeUsers.username != :username', {
username: filter.username,
}).getMany()
I am posting the following to the Shopify API create order endpoint and receiving a response without tax lines that are filled. I haven't seen anything on the internet on this, other than that Shopify doesn't offer another endpoint for just taxes. So, I am trying to figure out if tax lines are supposed to be generated automatically in the order response when creating an order via the API or if I have to include the tax lines in the request in order for tax lines to be included, because I know when I create an order in the admin the tax lines are automatically calculated and included for me?:
{
"order": {
"email": "some#email.com",
"financial_status": "paid",
"fulfillment_status": null,
"send_receipt": true,
"send_fulfillment_receipt": true,
"note": "Created by somename",
"line_items": [
{
"variant_id": 21718275463,
"quantity": 1,
"price": 99,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717700871,
"quantity": 1,
"price": 1000,
"requires_shipping": true,
"product_id": 6820646151
},
{
"variant_id": 21717690055,
"quantity": 1,
"price": 555,
"requires_shipping": true,
"product_id": 6821668807
}
],
"processing_method": "offsite",
"shipping_address": {
"first_name": "Chris",
"address1": "10101 Musick Road",
"phone": "9999999999",
"city": "St. Louis",
"zip": "63123",
"province": "MO",
"country": "United States",
"last_name": "Becker",
"name": "Chris Becker",
"country_code": "US",
"province_code": "MO"
},
"source_name": "somename",
"taxes_included": false,
"shipping_lines": [
{
"title": "standard",
"price": 0.00,
"code": null,
"source": "brand owner on shopify",
"carrier_identifier": null,
"tax_lines": null
}
],
"tags": "some Order"
}
}
Here is a useful documentation about tax: https://help.shopify.com/api/reference/location
Tax are not automatically calculated from cart.js ajax api. They just give a clue whether tax is already included in the price or not. If not, then it can be added with the bill.
I ran _">https://graph.facebook.com/act_47121778/adcreatives?access_token=_
and got the following results. Why are some creatives returning empty image hash?
{
"view_tag": "",
"alt_view_tags": [
],
"creative_id": "6002716206572",
"type": 1,
"title": "Grow your fans!",
"body": "Fan Page Owners! Grow your fanbase. Create quizzes for your page. Win $100 Weekly. Make money with our revenue share program.",
"image_hash": "6ac30e43f21c8580361de92d3288ed68",
"link_url": "http://www.facebook.com/quizwriter?sk=app_81434956828",
"name": "Grow your fans!",
"run_status": 1,
"preview_url": "http://www.facebook.com/ads/api/creative_preview.php?cid=6002716206572",
"count_current_adgroups": 1,
"id": "6002716206572",
"image_url": "http://creative.ak.fbcdn.net/v41818/flyers/109/44/1296329249810543669_1_31eb15ed.jpg"
},
{
"view_tag": "",
"alt_view_tags": [
],
"creative_id": "6002444043572",
"type": 1,
"title": "Tennis Champs Social Game",
"body": "Tennis Champ! Start with 5,000 dollars , beat out other players with your mad tennis skills and become the tennis champ! Socialize!",
"image_hash": "",
"link_url": "334886511760",
"name": "Tennis Champs Social Game",
"run_status": 1,
"preview_url": "http://www.facebook.com/ads/api/creative_preview.php?cid=6002444043572",
"count_current_adgroups": 2,
"id": "6002444043572"
},