How do you get scrollposition off LazyRow. is it possible in any way to get the float position of user scroll in LazyRow. I understand that you have to dceal with listState but i cant find the position inside the list state... Please help
Related
its been a month since I started using Apache Superset. I have a graph that gives the accuracy of an event occuring on a given hour shown below.
The event occuring is a column named 'prediction' which is either 'Left' or 'Right'. Is there a way to colorize the bars according to the value in 'prediction' column. If the prediction is Left then red colored bar and green colored bar when Right etc. I have checked metadata but I am not sure how I can edit it. Is there a way to achieve this?
I was able to solve it by using the 'prediction' column in breakdown function few days ago. Thank you Kamal for providing an answer as well!
So I have zero knowledge of how to operate SAP Crystal Reports but find myself needing to make a report for some everyday tasks. I found a similar report already created in the system and tried adapting it (after "saving as" so I don't break the original file) but am not getting the results I am looking for.
My goal is to highlight specific information when it appears. If a person makes a mistake and enters the wrong information in our software, the report will highlight the error for me.
All I would like it to do is when there is information that doesn't match the formula it will highlight it yellow or red etc.
For example, code I've been trying to get work is:
if ({vw_Tickets.SiteName} = "SCALE" and {vw_Tickets_Material_Detail.MaterialCode} = "22CD") then crred else crwhite;
I have different variations of the above code stacked on top of one another, the names change but that's about it.
I don't know if I'm using the formula wrong or if I'm typing it in the wrong location. To make my changes I'm in Section Expert > Details > Color > and then the red x-2 next to the color list > details > background color.
The Highlighting Expert doesn't do what I need it to do. I need it to highlight when something unusual happens.
I know that probably doesn't make a lot of sense, but any help or direction would be appreciated!
Screenshot of crystal report formula
The semicolons are not correct. The formula should only have one result. Try to write something like this:
If {siteName} = "TIGER-TECH" Then crlime Else
If {siteName} = "EMPLOYEE DUMP ACCOUNT" Then crlime Else
If {siteName} = "SCALE CACHE" ... Then crRed
// Last One
Else "crWhite"
If you want to leave the original font color you should use "crNoColor".
I am using feedparser to parse RSS feed from spotcrime
However, I am getting "no attribute" error whenever I'm trying to loop through the entries to get the 'geo_long' and 'geo_lat' attribute.
If I don't loop than it works fine:
f = feedparser.parse(link)
entries = f.entries
print entries[0].geo_long
But when I do it in a loop like this, it starts giving me error
for e in entries:
print e.geo_long
And this error is only for geo_long/geo_lat/where attribute on my feed. Other attributes work just fine when accessed in a loop. Can someone please let me know the problem? Thanks
I found a way to go around this by using e.get('geo_long') instead and it worked. Still don't know why the other way does not work though
I'm just starting to explore Xlrd, and to be honest am pretty new to programming altogether, and have been working through some of their simple examples, and can't get this simple code to work:
import xlrd
book=open_workbook('C:\\Users\\M\\Documents\\trial.xlsx')
sheet=book.sheet_by_index(1)
cell=sheet.cell(0,0)
print cell
I get an error: list index out of range (referring to the 2nd to last bit of code)
I cut and pasted most of the code from the pdf...any help?
You say:
I get an error: list index out of range (referring to the 2nd to last
bit of code)
I doubt it. How many sheets are there in the file? I suspect that there is only one sheet. Indexing in Python starts from 0, not 1. Please edit your question to show the full traceback and the full error message. I suspect that it will show that the IndexError occurs in the 3rd-last line:
sheet=book.sheet_by_index(1)
I would play around with it in the console.
Execute each statement one at a time and then view the result of each. The sheet indexes count from 0, so if you only have one worksheet then you're asking for the second one, and that will give you a list index out of range error.
Another thing that you might be missing is that not all cells exist if they don't have data in them. Some do, but some don't. Basically, the cells that exist from xlrd's standpoint are the ones in the matrix nrows x ncols.
Another thing is that if you actually want the values out of the cells, use the cell_value method. That will return you either a string or a float.
Side note, you could write your path like so: 'C:/Users/M/Documents/trial.xlsx'. Python will handle the / vs \ on the backend perfectly and you won't have to screw around with escape characters.
I've been trying to retrieve the locations of all the page breaks on a given Excel 2003 worksheet over COM. Here's an example of the kind of thing I'm trying to do:
Excel::HPageBreaksPtr pHPageBreaks = pSheet->GetHPageBreaks();
long count = pHPageBreaks->Count;
for (long i=0; i < count; ++i)
{
Excel::HPageBreakPtr pHPageBreak = pHPageBreaks->GetItem(i+1);
Excel::RangePtr pLocation = pHPageBreak->GetLocation();
printf("Page break at row %d\n", pLocation->Row);
pLocation.Release();
pHPageBreak.Release();
}
pHPageBreaks.Release();
I expect this to print out the row numbers of each of the horizontal page breaks in pSheet. The problem I'm having is that although count correctly indicates the number of page breaks in the worksheet, I can only ever seem to retrieve the first one. On the second run through the loop, calling pHPageBreaks->GetItem(i) throws an exception, with error number 0x8002000b, "invalid index".
Attempting to use pHPageBreaks->Get_NewEnum() to get an enumerator to iterate over the collection also fails with the same error, immediately on the call to Get_NewEnum().
I've looked around for a solution, and the closest thing I've found so far is http://support.microsoft.com/kb/210663/en-us. I have tried activating various cells beyond the page breaks, including the cells just beyond the range to be printed, as well as the lower-right cell (IV65536), but it didn't help.
If somebody can tell me how to get Excel to return the locations of all of the page breaks in a sheet, that would be awesome!
Thank you.
#Joel: Yes, I have tried displaying the user interface, and then setting ScreenUpdating to true - it produced the same results. Also, I have since tried combinations of setting pSheet->PrintArea to the entire worksheet and/or calling pSheet->ResetAllPageBreaks() before my call to get the HPageBreaks collection, which didn't help either.
#Joel: I've used pSheet->UsedRange to determine the row to scroll past, and Excel does scroll past all the horizontal breaks, but I'm still having the same issue when I try to access the second one. Unfortunately, switching to Excel 2007 did not help either.
Experimenting with Excel 2007 from Visual Basic, I discovered that the page break isn't known unless it has been displayed on the screen at least once.
The best workaround I could find was to page down, from the top of the sheet to the last row containing data. Then you can enumerate all the page breaks.
Here's the VBA code... let me know if you have any problem converting this to COM:
Range("A1").Select
numRows = Range("A1").End(xlDown).Row
While ActiveWindow.ScrollRow < numRows
ActiveWindow.LargeScroll Down:=1
Wend
For Each x In ActiveSheet.HPageBreaks
Debug.Print x.Location.Row
Next
This code made one simplifying assumption:
I used the .End(xlDown) method to figure out how far the data goes... this assumes that you have continuous data from A1 down to the bottom of the sheet. If you don't, you need to use some other method to figure out how far to keep scrolling.
Did you set ScreenUpdating to True, as mentioned in the KB article?
You may want to actually toggle it to True to force a screen repaint. It sounds like the calculation of page breaks is a side-effect of actually rendering the page, rather than something Excel does on demand, so you have to trigger a page rendering on the screen.