Currently I'm working with Hyperledger chaincode,
I have a problem with the method "GetStateByPartialCompositeKey".
They index consists of 3 parts (key1~key2~key3).
If i try GetStateByPartialCompositeKey(index, key1) , it works perfectly.
But If I try to search for another key, like GetStateByPartialCompositeKey(index, key3), nothing is returned. Although the key is actually saved. How do I solve this problem?
Refer: https://godoc.org/github.com/hyperledger/fabric/core/chaincode/shim#ChaincodeStub.GetStateByPartialCompositeKey
As mentioned in the description of the method, "This function returns an iterator which can be used to iterate over all composite keys whose prefix matches the given partial composite key."
This method needs to have the prefix i.e. the first half of the composite key to match. Even though the method name may state partial key, it only works with the prefix of the composite key and not any part of it.
Related
I have overridden the APPrintChecks data view to sort by Vendor Code. But since the client's VendorCodes are all numeric, they would like to see the checks sorted so that, for example, VendorCode '357' is printed before VendorCode '10021'.
Any ideas on how I can accomplish that?
public class APPrintChecks_Extension : PXGraphExtension<APPrintChecks>
{
//change sort from Vendor Name to Vendor Code
[PXFilterable]
public PXFilteredProcessingJoin<APPayment, PrintChecksFilter,
InnerJoin<Vendor, On<Vendor.bAccountID, Equal<APPayment.vendorID>>>,
Where<boolTrue, Equal<boolTrue>>,
OrderBy<Asc<Vendor.acctCD, Asc<APPayment.refNbr>>>> APPaymentList;
}
As per suggestion in the comments, I would first check if there is another numeric/date field you can sort on such as BAccountId or CreatedDate. If this will not do, you will need to find a more creative way to fix it such as:
Changing Vendor Code Numbering Sequence to include leading zeros,
example: 0000357, 001021
Adding a custom field (which is stored in the database) and setting this custom field in the graph to include the leading zeros. Example
add field UsrVendorCode of type string where you add the leading
zeros in an event (of the Vendor Graph) such as RowPersisting.
Adding a calculated database field to add leading zeros and adding this as a custom field (extension of Vendor) in Acumatica (not sure
whether this is fully supported by Acumatica since it requires
modifications in DB)
I am trying this query and it is not working:
OrderFulfillment.where(shopper_id: shopper.id, fulfillment_status: [:fulfillment_requested_assignment, :fulfillment_assigned, :fulfillment_shopping])
I am not sure why but I am unable to get querying using enums to work
OrderFulfillment.where(shopper_id: shopper.id,
fulfillment_status: OrderFulfillment
.fulfillment_statuses
.values_at([:fulfillment_requested_assignment,
:fulfillment_assigned,
:fulfillment_shopping]))
Rails isn't smart enough to know that you are passing keys and not values, so when you were passing the statuses straight like that it was looking for the wrong values (it changed them to null because it didn't understand). The enums are physically stored as integers, so that's what you actually need to use in the query. Therefore, you can use the Rails-provided fulfillment_statuses method to grab a hash of the key/value pairs of the enum, and then the values_at method of the hash to get the values for the array of keys you pass in.
How to use the KV_INCR_KEY?
I found a useful feature in gwan api, but without any sample.
I want to add items to the KV store with this as primary key.
Also, how to get the value of this key?
The KV_INCR_KEY value is a flag intended to be passed to k_add().
You get the newly inserted key's value by checking the return value of k_add(). The documentation states:
kv_add(): add/update a value associated to a key
return: 0:out of memory, else:pointer on existing/inserted kv_item struct
This was derived from an idea discussed on the G-WAN forum. And, like for some other flags (timestamp or persistence, for example), it has not not been implemented yet (KV_NO_UPDATE is functional).
Since what follows the next version (focussed on new scripted languages) is a kind of zero-configuration mapReduce, the KV store will get more attention soon.
I am using Neography. I created an index, and have a node with this property:
But this code returns nil:
#neo.find_node_index("lucene","id_str", "5426722")
What am I doing wrong?
The format is: #neo.get_node_index(index, key, value)
The name of your index happens to be the same name as your key (I am assuming since we can see the index name, but not the key that was used).
#neo.get_node_index("id_str","id_str", "5426722")
You can find some examples on how to do it in the neography GitHub repository.
Have you tried get_node_index instead. It looks like it should have the same functionality for the values you are supplying, since you aren't passing a query?
How do I tell the Zend_Form that I want an element (and it's ID-label, etc) to use another ID value instead of the element's name?
I have several forms in a page. Some of them have repeated names. So as Zend_Form creates elements' IDs using names I end up with multiple elements with the same ID, which makes my (X)HTML document invalid.
What is the best solution to fix this, given that I really have to stick with using the same element names (they are a hash common to all forms and using the Zend_Form Hash Element is really out of question)?
Zend_Form_Element has a method called setAttribs that takes an array. You may be able to do something like $element->setAttribs(array('id' => "some_id"));
or you can do $element->setAttrib('id', 'some_id');
Thanks, Chris Gutierrez.
However, as I said, I needed to get ride of the default decorator generated IDs like -label. Wiht the $element->setAttribs() it is not possible, however.
So based on http://framework.zend.com/issues/browse/ZF-7125 I just did the following:
$element->clearDecorators();
$element->setAttrib('id', 'some_id');
$element->addDecorator("ViewHelper");
Whoever sees this: please note this was enough for what I needed. But may not be for you (the default settings has more than the viewHelper decorator).