on my way to help a fellow I wrote a simple F-Script without even knowing the existing of such language
http://forums.marketcircle.com/eve/forums/a/tpc/f/2931083693/m/883106236
but I tried to find a way to round the number to 2 decimal places and I found nothing.
Can someone help me out that to finalize my help? Thank you.
The script is:
"Get amount to use from API"
amountEur := element valueForKeyPath:'parent.reportData.object.subtotalPlusMarkupMinusDiscount'.
"Let's convert to EEK"
amountEEK := amountEur / 15.6466.
"Return the value"
amountEEK.
working script after answer
"Get amount to use from API"
amountEur := element valueForKeyPath:'parent.reportData.object.subtotalPlusMarkupMinusDiscount'.
"Let's convert to EEK"
amountEEK := amountEur / 15.6466.
"Floor it"
floorEEK := ((amountEEK * 100) + 0.5) floor.
"Return the value"
floorEEK / 100.
If there's not a native round function then this should work:
Multipy by 100, floor, divide by 100.
Related
I need to hide all decimal values from the sub_total and total_amount of the sale_orders.
For that opened the currency settings from _ Accounting->Multicurrencies -> Currencies _ and then set Rounding Factor from 0.010000 to 0.000000 (got this clue from somewhere on the internet).
However, this produces a divide by zero error on Confirm Sale, when the total_amount is zero (due to 100% discounts)- specifically at
File "/opt/bahmni-erp/odoo/addons/account/models/account_move.py", line 63, in _compute_matched_percentage
move.matched_percentage = total_reconciled / total_amount
The code block at that location is
if float_is_zero(total_amount, precision_rounding=precision_currency.rounding):
move.matched_percentage = 1.0
else:
move.matched_percentage = total_reconciled / total_amount
That float_is_zero is calling some other set of functions and finally executes the else part and the division error.
When I set the rounding to 1.000000 - I think the issue is getting resolved and there's no such error now.
I couldn't find much documentation about the behavior of this field and how it's getting used under Odoo.
Could you please confirm whether the above solution is okay and won't make any more side effects?
Thanks.
To work around this,
change digits from (12,6) to (12,10).
Find file vim /usr/lib/python2.7/site-packages/openerp/addons/base/res/res_currency.py and search for the next strings:
1- First Change:
rate= fields.function(_get_current_rate, string='Current Rate', digits=(12,10),
2- Second Change:
class res_currency_rate(osv.osv):
_name = "res.currency.rate"
_description = "Currency Rate"
rate= fields.float('Rate', digits=(12, 10), help='The rate of the currency to the currency of rate 1'),
Hope It helped.
I am trying to make a shop in my game, and I want my text to say, "Object - £30" or something, but when I type in the sign, when I run the game, all it says is Object - 30 even if I typed in the sign. here is the code:
draw_self();
draw_text_transformed(x + -90, y + -20, string("Shelf - £ 60") + "", 2, 2, 0);
draw_set_colour($FF000000 & $ffffff);
var l4109CEE6_0=($FF000000 >> 24);
draw_set_alpha(l4109CEE6_0 / $ff);
Does anyone know how I can solve this?
Have you tried using unicode?
\u00A3 for £ for example
Two things:
Your font of choice must contain the said glyph (you can check with FontForge)
You need to add a range for the glyph(s) in GameMaker:
I've been researching hours without success
I just need the syntax for Autohotkey to get the size of a table rows/column
I am following this guide https://www.guru99.com/handling-dynamic-selenium-webdriver.html
In other languages they suggest this:
WebElement tbody = driver.findElement(By.xpath("//div[#class='z-listbox-body']/table/tbody"));
List<WebElement> rows = tbody.findElements(By.xpath("tr"));
totalrows = rows.size();
Note that they use the "List" to convert into a List type the variable, the problem is, that in AHK there is no variable type definition, it should be automatically, but apparently not in this case
This is the page I am doing test on, but can't get it to work
http://demo.guru99.com/test/web-table-element.php#
I just need to know how many rows and/or columns it has, it should be as simple as this:
MsgBox % "" oChrome.findElementByXpath("//*[#id='leftcontainer']/table/thead/tr/th").size()
(Gives no error but doesnt show any value)
Or even this, like there they suggested (How to get the total number of elements in a HTML with Selenium WebDriver and Autohotkey?)
MsgBox % "" oChrome.findElementByXpath("//*[#id='leftcontainer']/table/thead/tr/th").Count()
(Error: Unknown Name, Specifically: Count)
The goals is to have the number of columns (in this case 5) and Rows (26), this, in order to further fo a For Each and loop through the values of each row
I would appreciate any kinds of suggestions, thanks!
Full Code
oChrome := ChromeGet() ; Object for Chrome
MsgBox % "" oChrome.findElementByXpath("//*[#id='leftcontainer']/table/thead/tr/th").Size() ; FAIL
MsgBox % "Finish"
return
ChromeGet(IP_Port := "127.0.0.1:9222") {
oChrome := ComObjCreate("Selenium.ChromeDriver")
oChrome.SetCapability("debuggerAddress", IP_Port)
oChrome.Start()
return oChrome
}
Ahh, so, after days of research, I noted a a little bigger thing, I needed to use:
.findElementsByXpath()
Instead of:
.findElementByXpath()
I noticed tht when looking in this Selenium documentarion for Python:
https://selenium-python.readthedocs.io/locating-elements.html
Which made me thing on that extra "s" on it, and so, it was that! and also I used Count().
And it falls in a simple logic (and common sense now I realize), findElementsByXpath(), as the docs said, search for multiple element values, not just one, that way you are allowed to use the ".Count()" to search for the total of children in a node for example
So, the end code working for me is the following:
oChrome := ChromeGet() ; Object for Chrome
MsgBox % "" oChrome.findElementsByXpath("//*[#id='leftcontainer']/table/thead/tr/th").Count()
MsgBox % "Finish"
return
ChromeGet(IP_Port := "127.0.0.1:9222") {
oChrome := ComObjCreate("Selenium.ChromeDriver")
oChrome.SetCapability("debuggerAddress", IP_Port)
oChrome.Start()
return oChrome
}
I am more or less new to VB.NET and I am trying to program a simple console application for a basic finance and savings calculation program.
I am having trouble with the Math.Log() function and I hope someone can help me to point out my
mistake/mistakes.
This is the values I need to get working (the brackets shows the values that actually should work but do not in my code):
Public Class basicSavingsPlaner
Private userTotalCost As Double (50,000.00)
Private userSaves As Double (3,451.47)
Private userAnnualRate As Decimal (0,08)
Private userMonths As Double (should be 10)
If I use my regular calculator (TI-82) I get the correct answer of userMonths which is 10, this is how I type it on my calculator (I switched the values from digits to the names of my Declarations):
(log(((userAnnualRate * userTotalCost)/userSaves)+1)/(log(1+userAnnual)) = 10.0029...
This is my attempt to recreate it for my VB.NET console application:
userMonths = ((Math.Log((userAnnualRate * userTotalCost) / userSaves) + 1) / (Math.Log(1 + userAnnualRate)))
In this case, userMonths's result is 14.9, which is wrong.
I would really appreciate if someone could help me, I have search here in this forum and on Google for days now.
// Televeinken
If you look closely at the statement from your TI-82 and compare it with your VB.Net code you will see that you have the statement grouped differently between the two. Try something like this(note the grouping of three brackets after the initial log statement instead of two):
userMonths = (Math.Log(((userAnnualRate * userTotalCost) / userSaves) + 1) / (Math.Log(1 + userAnnualRate)))
userMonths = 10.000008962349851
The problem is with the grouping expressions with brackets () that is you are executing different expressions with Math.Log and log.
if you change like this ((Log((userAnnualRate * userTotalCost) / userSaves) + 1) / (Log(1 + userAnnualRate)))
means it will also result in 14.9
OR you can make a change like
(Math.Log(((userAnnualRate * userTotalCost) / userSaves) + 1) / (Math.Log(1 + userAnnualRate)))
then both will result in 10.00
I want to retrieve all the files from a cabinet (called 'Wombat Insurance Co'). Currently I am using this DQL query:
select r_object_id, object_name from dm_document(all)
where folder('/Wombat Insurance Co', descend);
This is ok except it only returns a maximum of 100 results. If there are 5000 files in the cabinet I want to get all 5000 results. Is there a way to use pagination to get all the results?
I have tried this query:
select r_object_id, object_name from dm_document(all)
where folder('/Wombat Insurance Co', descend)
ENABLE (RETURN_RANGE 0 100 'r_object_id DESC');
with the intention of getting results in 100 file increments, but this query gives me an error when I try to execute it. The error says this:
com.emc.documentum.fs.services.core.CoreServiceException: "QUERY" action failed.
java.lang.Exception: [DM_QUERY2_E_UNRECOGNIZED_HINT]error:
"RETURN_RANGE is an unknown hint or is being used incorrectly."
I think I am using the RETURN_RANGE hint correctly, but maybe I'm not. Any help would be appreciated!
I have also tried using the hint ENABLE(FETCH_ALL_RESULTS 0) but this still only returns a maximum of 100 results.
To clarify, my question is: how can I get all the files from a cabinet?
You have already accepted an answer which is using DFS.
Since your are playing with DFC, these information might help you.
DFS:
If you are using DFS, you have to aware about the number of concurrent sessions that you can consume with DFS.
I think it is 100 or 150.
DFC:
Actually there is a limit that you can fetch via DFC (I'm not sure with DFS).
Go to your DFC application(webtop or da or anything) and check the dfc.properties file.
# Maximum number of results to retrieve by a query search.
# min value: 1, max value: 10000000
#
dfc.search.max_results = 100
# Maximum number of results to retrieve per source by a query search.
# min value: 1, max value: 10000000
#
dfc.search.max_results_per_source = 400
dfc.properties.full or similar file is there and you can verify these values according to your system.
And I'm talking about the ContentServer side, not the client side dfc.properties file.
If you use ENABLE (RETURN_TOP) hint with DFC, there are 2 ways to fetch the results from the ContentServer.
Object based
Row based
You have to configure this by using the parameter return_top_results_row_based in the server.ini file.
All of these changes for the documentum server side, not for your DFC/DQL client.
Aha, I've figured it out. Using DFS with Java (an abstraction layer on top of DFC) you can set the starting index for query results:
String queryStr = "select r_object_id, object_name from dm_document(all)
where folder('/Wombat Insurance Co', descend);"
PassthroughQuery query = new PassthroughQuery();
query.setQueryString(queryStr);
query.addRepository(repositoryStr);
QueryExecution queryEx = new QueryExecution();
queryEx.setCacheStrategyType(CacheStrategyType.DEFAULT_CACHE_STRATEGY);
queryEx.setStartingIndex(currentIndex); // set start index here
OperationOptions operationOptions = null;
// will return 100 results starting from currentIndex
QueryResult queryResult = queryService.execute(query, queryEx, operationOptions);
You can just increment the currentIndex variable to get all results.
Well, the hint is being used incorrectly. Start with 1, not 0.
There is no built-in limit in DQL itself. All results are returned by default. The reason you get only 100 results must have something to do with the way you're using DFC (or whichever other client you are using). Using IDfCollection in the following way will surely return everything:
IDfQuery query = new DfQuery("SELECT r_object_id, object_name "
+ "FROM dm_document(all) WHERE FOLDER('/System', DESCEND)");
IDfCollection coll = query.execute(session, IDfQuery.DF_READ_QUERY);
int i = 0;
while (coll.next()) i++;
System.out.println("Number of results: " + i);
In a test environment (CS 6.7 SP1 x64, MS SQL), this outputs:
Number of results: 37162
Now, there's proof. Using paging is however a good idea if you want to improve the overall performance in your application. As mentioned, start counting with the number 1:
ENABLE(RETURN_RANGE 1 100 'r_object_id DESC')
This way of paging requires that sorting be specified in the hint rather than as a DQL statement. If all you want is the first 100 records, try this hint instead:
ENABLE(RETURN_TOP 100)
In this case sorting with ORDER BY will work as you'd expect.
Lastly, note that adding (all) will not only find all documents matching the specified qualification, but all versions of every document. If this was your intention, that's fine.
I've worked with DFC API (with Java) for a while but I don't remember any default limit on queries, IIRC we've always got all of the documents, there weren't any limit. Actually (according to my notes) we have to set the limit explicitly with, for example, enable (return_top 2000). (As far I know the syntax might be depend on the DBMS behind EMC Documentum.)
Just a guess: check your dfc.properties file.