Restart list numbering in word for each new list created - css

I am exporting content from a jsp page into MS Word using javascript.
When the user is in Word there is a table with 10 rows and 2 columns, A & B. The user creates an ordered list in row 1, column A like this:
1 dog
2 cat
3 mouse
if the user then creates a second list in row 1 column B is turns out like this:
4 car
5 truck
6 bike
instead of:
1 car
2 truck
3 bike
Word is set up to continue the numbering in lists from prior lists automatically. I know this can be reset easily but the users dont want to have to do this. They want the numbering of any potential lists created to restarted at 1. when the document is exported into Word and opened in front of them.
So this must be set up in the javasctipt code or using a style or something prior to getting into Word. This is what I dont know how to do.
Any help is much appreciated.
Thanks,
Feena.

If you use a named sequence rather than the in-built lists (as in inserting an instnace of the field {SEQ SequenceName} everywhere you want a number), and choose a different name for each of the different lists, it will work as you desire.
e.g.
{SEQ OpenIssueSeq} Issue 1
(SEQ OpenIssueSeq} Issue 2
etc.

Related

DT::dataTableOutput with table in long form and still having full functionality?

In R Shiny, I have a data table in wide form, let's all this Representation A of the data:
Rank
Person
School
1
Sean
Boston
2
Alicia
I'm using DT::dataTableOutput to present this table. I want to instead present this table in long form (Rank identifies the observations):
Rank
Variable
Value of Variable
1
Person
Sean
1
School
Boston
2
Person
Alicia
2
School
I will then also style this table slightly differently, I will:
Only print the first occurrence of a value of rank
The table then becomes:
Rank
Variable
Value of Variable
1
Person
Sean
School
Boston
2
Person
Alicia
School
I will also:
Drop empty rows
So the final table, which we will call Representation B of the data, becomes:
Rank
Variable
Value of Variable
1
Person
Sean
School
Boston
2
Person
Alicia
When presenting the table in the format B, I still want to keep as much of the functionality as possible that DT::dataTableOutput supplies for form A, e.g. the ability to search and sort (without separating rows belonging together) etc. Here, by sorting I don't mean the order variables are presented in within a given rank, but the order the "rank groups" are presented. For example, sorting on Person should yield the following since Alicia comes before Sean lexicographically:
Rank
Variable
Value of Variable
2
Person
Alicia
1
Person
Sean
School
Boston
What do you think is the easiest way to implement this?
Currently, I consider two different ways. In both plans, instead of having the standard sorting buttons provided by DT::dataTableOutput, I will link e.g. a radio button which will allow the user to choose which variable the table should be sorted on (i.e. Rank, Person, or School).
My first option for implementation: When the radio button is pressed, I will (without the user seeing it) transform the table to representation A, sort it there, then transform it to the properly sorted version of representation B.
My second option for implementation: I could to representation B "attach" representation A (without showing the latter to the user) so that each row of the underlying data contains the full information for that rank:
Rank
Variable
Value of Variable
Rank_Long
Person_Long
School_Long
1
Person
Sean
1
Sean
Boston
School
Boston
1
Sean
Boston
2
Person
Alicia
2
Alicia
If I want to obtain the lexicographically sorted B representation, I order the table above by (Person_Long, Rank_Long, Variable). The extra Variable in the ordering is added to get the rows presented to the user (Rank and Variable) in the right order (Person above School).
In practice, I will have around five to ten variables rather than only two (and each of these ten should be allowed to sort on), and I will be running Shiny Server on an AWS server which will be reached through an iframe on a website.
Pros and cons of the first and second options for implementation:
First option: Fast if the dcast and melt functions are fast enough and if melt can be set to preserve the sorting when transforming to long. Should provide faster initial load time of the table for the user since the table won't have as many columns as the second option.
Second option: No reshape needed, but more data sent to the user at initial load.
Which of my two options do you think is the best, and do you have suggestions about other implementations I haven't considered?
I concatenated my columns of interest using paste with properly placed <br> tags for line break. Using DT::datatable(..., escape = FALSE) I could then obtain the table in the form I wanted.
I defined a sliderInput (outside of the table) whose input I set to trigger events for sorting. The table reloads (thus resetting search) when the slider obtains a new input, I will try to fix that (with some filter or proxy solution, or hopefully I find a simple way).

How to scrape a complex table which has columns spanning multiple rows (a pedigree chart) in R?

I've looked at all the other related Stack Overflow questions, and none of them are close enough to what I'm trying to do to be useful. In part because, while some of those questions address dealing with tables where the leftward columns span multiple rows (as in a pedigree chart), they don't address how to handle the messy HTML which is somehow generating the chart. When I try the usual ways of ingesting the table with rvest it really doesn't work.
The table I'm trying to scrape looks like this:
When I extract the HTML of the first row (tr) of the table, I see that it contains: Betty, Jack, Bo, Bob, Jim, Dan, b 1932 (the very top of the table).
Great, you say, but not so fast. Because with this structure there's no way to know that Betty's mom is Sue (because Sue is on a different row).
Sue's row doesn't include Betty, but instead starts with Sue herself.
So in this example, Sue's row would be: Sue, Owen, Jacob, Luca, Blane, b 1940.
Furthermore, the row #2 in the HTML is actually just Ava b 1947.
I.e., the here's the content of each HTML row:
I tried using rvest to download the page and then extract the table.
A la:
pedigree <- read_html(page) %>% html_nodes("#PedigreeTable") %>% html_table
It really didn't work. Oddly, I got every column duplicated twice--so not too bad, but I'd rather it be a tibble/dataframe/matrix with the first column being 32 Bettys, and then the next column be 16 of each of Jack and Sue, etc...
I hope this is all clear as mud!
Ideally, as far as output, I'd get a nice neat dataframe with the columns person, father, mother. Like so:
Thanks in advance!
Maybe writting a algorithm can do it, like :
Select only the last two columns :
father_name=first value of the penultimate column
then browse the column to find the next non-NA value, count each rows
count=1 + number of NA values
mother_name=second non NA value
then count all rows until you find a name
count=count + 1 + number of NA values
Create your final table with :
name | father | mother
Isolate all the family's child names, and save them in your final table.
Assign father_name and mother_name in corresponding columns in your final table
Delete all rows used and start again.
Once you have assigned all the last column-people to their parents, delete the last column.
Then, delete all blank rows to have a structure similar to the one needed in the fist step, and start the algorithm again
Hope that helps !!
PS : I suggest that you give an unique ID to each person at some point, to avoid confusion between people that have the same name.

How to either relocate a frame after it's been realized or assign a browse to another frame in Progress ABL?

Ok Progress Virtuoso's,
I'm trying to create a character UI that consists of 6 browses and 6 frames. The vision I currently have is to fire off an ON tab trigger for browse 1 that cues events - show/focus browse 2. Then on tab of browse 2 show/focus browse 3. The next tab trigger is where I am stuck because I want to do the exact same thing with some additional changes to the trigger. Those differences to the trigger involve shifting the location of browse 2/frame 2 to the position of browse 1/frame 1, shifting browse 3/frame3 to the previous position of browse 2/frame, and browse 4/ frame 4 would take 3's position.
Users View =
1 (trigger)
1 2 (trigger)
1 2 3 (trigger)
2 3 4 (trigger)
3 4 5 (trigger)
4 5 6 (trigger)
Bold indicates which frame is in focus.
I'm fairly sure that's it not possible to assign a static browse to more than one frame. Error 3475 states exactly that...however I want to be sure that is the case? Is it possible to reposition a frame after it's realized? Alternatives approaches/suggestions or any insight would be greatly appreciated.
Sorry everyone, but I was able to solve this after looking at frame attributes. Turns out you can reposition a frame with column and row attributes. If you read this...sincere apologies for wasting your time!

Dojo DataGrid: Filter column - condition: Values in CSV string exist in an Array?

I am using Dojo DataGrid with dojo 'AndOrReadStore' so that I can use complex queries on column data.
I have a column, say DocumentTypeIds, in dojo DataGrid that shows comma seperated string of type ids of a document for each document row. Lets say its value is '5, 6' among 20 different possible values. These document types are further categorized into 3 categories: A, B, C. for example
Document Type/name | A B C
---------------------------
5 / finance report | 1 0 0
6 / summary report | 0 1 0
Based on choice of A, B and C, I want to filter documents in the grid. For example if user chose C and document type ids are '5,6' then I do not want to filter this document. I can filter the possible document type ids based on category in an array that I want to compare this column against. Lets assume the possible values after choosing option C are [8, 9, 2, 99] then my filtering condition needs to be
[5,6] in [8,9,2,99]
or
'5,6' in '8,9,2,99'
The problem with first approach is that column values are in CSV format so i dont think i can convert those into array in query. The problem with second approach is that i dont want to find string '5,6' in '8,9,2,99' rather i want to find if both '5' and '6' exist in the '8,9,2,99' and they may not appear next to each other in '8,9,2,99'.
I don't know how to approach this problem as it is very important for me to filter the rows at client side because I want to bring in all rows and let user choose what type of documents they want to see.
grid.filter({complexQuery: "DocumentTypeIds: ? "});
I appreciate any help.
Thanks

Best way to implement a read and write for an unknown amount of rows

I asked a question similarly, but the outcome was pretty messy and I was having difficulties populating so I'm trying to go at from a different angle:
Question concerning asp:listview and multiple dynamically created controls
I have a table which stores steps in a process. Some companies only have 6 steps while others have 15, so I created a table with 15 different slots for steps. What I would like to do is set up a control that displays each step in its own row with a label next to it saying "Step '#'", and not in an adjacent column. I'd also like for it to not display any blank rows. If they are entering the step instructions, I would want for them to have to press a button that would add a row so that they aren't just given 15 empty text boxes to fill in.
What would be the best control to do this in, and how would I get started in setting it up?
You are putting data in the field names in the table, which makes your task more complicated. Instead of storing the steps in columns, like this:
CompanyId Step1 Step2 Step3 Step4 Step5 Step 6 Step7 ...
1 alpha beta gamma
2 one two three four five
You should store the steps as rows, so that you get the step number as data in a field:
CompanyId StepNumber Step
1 1 alpha
1 2 beta
1 3 gamma
2 1 one
2 2 two
2 3 three
2 4 four
2 5 five
This way you don't get any unused fields, and the data model doesn't pose any limitation on the number of steps. Also, you can easily get the steps as a collection instead of having to get each one separately and add to a collection.
Something like:
var steps =
from s in CompanySteps
where s.CompanyId = 2
orderby s.StepNumber
select new { s.StepNumber, s.Step };
Then you have many different options to display the steps, like using the collection as data source in a Repeater, or loop through the items and just create HTML code for them and put in a Literal control.

Resources