I'm having trouble with an RDLC using Local Reporting. I pass a 'QOI' object into the report, and I'm trying to get it to read the customer information.
The QOI object contains a customer object. This customer object has fields such as first name, last name, mid name, addresses, etc. I need to check if the QOI objects customer is null, and if not, write the firstName to a text box. So I've been trying this code...
=IIF(
IsNothing(First(Fields!customer.Value, "QOI")),
"Cash Sale",
First(Fields!customer.Value.firstName(), "QOI")
)
But that will just make the textbox say '#Error', with or without a customer attached. So, I tried this way.
=First(
IIF(
IsNothing(Fields!customer.Value),
"Cash Sale",
Fields!customer.Value.firstName()
)
, "QOI"
)
but this one gives me an #Error if theres no customer, or it says 'The specified operation is not valid' if there IS a customer... However, the following code works perfectly for stores.
=First(
IIF(
IsNothing(Fields!store.Value),
"Store Not Set",
Fields!store.Value.name()
)
, "QOI"
)
I've checked my variable names, intercepted the object and made sure everything was accurate... it just seems to hate customers. What could be causing this?
The only solution I could find was to create a custom object specifically for this report, and use a method that takes a QOI object and spits out a QOIReceipt object that has everything already populated. If anyone can see where I'm going wrong please let me know, otherwise the custom object seems to be the way to go.
Related
Imagine creating a new QTP project. You hit record to get your first bit of code in place. By default, you'll get something like:
Browser("MyApp").Page("MyPage").WebEdit("MyLogin").Set "Bob"
And you'll get the Browser, Page, and WebEdit objects automatically added to the repository. What I would like to be able to do, as one of those QTP bods that prefers descriptive programming, is hit record, and get something like:
Browser("name:=MyApp").Page("name:=MyPage").WebEdit("name:=MyLogin").Set "Bob"
And have no objects added to the repository. Is there a setting / option to do this somewhere?
(Obviously there are arguments for not wanting to do this, which I acknowledge and appreciate - but for those of us that prefer DP, this could help expedite test creation).
From what i understood is that you want to hit 'Record' button and you will get the script in descriptive type rather than the usual. But that is not possible.
For descriptive programming, you have to explicitly write the code by identifying the properties of each object for that (you can use Tools > Object Spy).
For above example:
Go to Object Spy > Select "the pointing hand symbol button" and click on the WebEdit for which you want to set the text "Bob"
Now, from Object Hierarchy select each object Top to Bottom and write properties of those object in the script. Like 1st Browser, then Page, then WebEdit. Try adding as more properties as you can.
You just can not get descriptive script by hitting Record button.
The following is a basic drools syntax:
$customer : Customer( )
Account( ) from $customer.accounts
As far as I know the first line create a new variable and assign it to the fact.
However I can't quite understand the second line especially what the "Account()" part means...
You have written class Customer, or must know it to understand what's going on here. Presumably it contains a Collection<Account> accounts (see note), which is (by the engine) retrieved one by one so that the rule fires for each Account object contained in Customer's object.
The rule will fire once for each Account object stored in any of the collections contained in all the Customer facts in working memory, with $customer being bound to the containing Customer.
You can bind another variable to Account.
Note: It could also contain a field Account accounts, but I hope the name was chosen carefully.
I'm trying to add to the PDF creditmemo rather the refund was given offline or online.
How do I get this information from the creditmemo?
I've tried to use the method getTotalOfflineRefunded() but it comes back null everytime.
Is there an arg for getData() I can use to get this value?
The values you are searching for, are saved on the order not on the creditmemo
In the creditmemo model(Mage_Sales_Model_Order_Creditmemo) you will find something like this
$this->getOrder()->setTotalOfflineRefunded(
$this->getOrder()->getTotalOfflineRefunded()-$this->getGrandTota
);
$this->getOrder()->setBaseTotalOfflineRefunded(
$this->getOrder()->getBaseTotalOfflineRefunded()-$this->getBaseGrandTotal()
);
So to get the total offline refunded you should try this:
$order->load('{orderId}')->getBaseTotalOfflineRefunded();
In case the difference between getBaseTotalOfflineRefunded() and getTotalOfflineRefunded() is not clear:
Base always indicates the order amount in your "base" currency, while the other method gets the amount in the currency of the store where the order was placed in.
Enums come back from the server as myEnum.SomeValue but what I'd like to show on screen is a formatted value such as "some value" instead of SomeValue.
That could be part of an attribute on the server-side model but it won't be passed in the metadata.
What's the best place then to do that kind of thing with breeze ?
We've discussed the idea of "extensible" metadata for Breeze but have not yet implemented it. Please vote for this here.
But in the meantime, there is nothing stopping you from "enhancing" the metadata returned by Breeze yourself. The best way to do this would be to add your own properties to either the "MetadataStore", "EntityType" or "DataProperty" classes.
The advantage of adding your custom metadata to existing metadata objects is that this data will be available whenever you work with any of the basic Breeze metadata.
Perhaps something like this: ( I haven't actually confirmed that this code is correct)
var custType = myEntityManager.metadataStore.getEntityType("Customer");
// assume that the 'status' property is actually an enumerated value where you want to
// add some custom metadata.
var statusProp = custType.getProperty("status");
// enumDescriptions is your custom property
statusProp.enumDescriptions = {
"PaidUp": "Paid Up",
"Delinq": "Delinquent",
"InArr": "In Arrears"
};
Now anywhere that you get given the "status" dataProperty, ( such as in a Validation), you will also have access to your "enumDescriptions"
Hope this makes sense.
Can Magento view/manage our customers by their business name in addition to their contact names to find them easily? It is being used for B2B, so when emails go out they are pulling the customer’s name, instead of the company name which is more appropriate.
Is this a global setting?
thanks in advance.
Magento stores business name on the customer's address by default, so it's a little harder to get to.
There's no reason you cannot add another customer field to put the company name on the customer record itself. That way you'll have no problem accessing it, and can change other screens in the system to reflect it.
If you don't want to go to those lengths, you could always implement a method that pulls the company name from the default address, and save it into the session by default, for easier retrieval.
EDIT: Better idea.
Looking through the sales email templates, there are two methods that are used to grab a customer's name:
$order->getCustomerName();
$order->getBillingAddress()->getName();
I don't see any separate references to the company name, so you should be able to substitute these two methods for your own and get the desired outcome. You'll need to create your own module and override the models for customer/address and sales/order (others have covered this in depth elsewhere). Then create methods that look something like this:
public function getCustomerName() {
if($this->getBillingAddress()->getCompany()) {
return $this->getBillingAddress()->getCompany();
}
return parent::getCustomerName();
}
That's the example for sales order, modify accordingly for customer. Now your company names will be used whenever available, and when they aren't the fallback will be to the original implementation (customer name).
Hope that helps!
Thanks,
Joe
You are correct about the universal application. If you did want just the emails, the concern is whether you have access to your custom function where you need it. If there's no object handy, I'm not positive that you will be able to call just any method that you need to.
An approach that would work in this case would be to override the two objects mentioned below, but to instead add a getCompanyName method to them. That way, you'll have the right objects to call, and you can edit the emails specifically to taste.