MIGX Event Calendar - modx

I have created a custom Eventcalendar with the following structure:
- Event 1 (Modx-Ressource 1)
Date/Time 1 (Migx-TV-Record) (i.e. 01-02-2016)
Date/Time 2 (Migx-TV-Record) (i.e. 01-03-2016)
...
- Event 2 (Modx-Ressource 2)
Date/Time 1 (Migx-TV-Record) (i.e. 01-04-2016)
Date/Time 2 (Migx-TV-Record) (i.e. 01-01-2016)
...
That means that the Modx-Ressource has some Information about the Event (like Ticketprice, Description, Title...) and multiple Eventdates/-times stored in a Migx-TV.
That worked so far... But i try to make a Output which i can sort by date, limit and so on... Maybe the output looks like this:
Event 2, Date/Time 2 (i.e. 01-01-2016)
Event 1, Date/Time 1 (i.e. 01-02-2016)
Event 1, Date/Time 2 (i.e. 01-03-2016)
Event 2, Date/Time 1 (i.e. 01-04-2016)
How can i get this done? Sorry for my bad English.

Using the MIGX getImageList snippet you can sort and filter:
[[!getImageList?
&tvname=`YourEventsTV`
&tpl=`YourEventTpl`
&sort=`[{"sortby":"your_event_start_date","sortdir":"asc"}]`
&where=`{"your_event_limit:>=":"100"}`
]]
Add a sort clause or a where clause (uses JSON strings for both). The MODX manual has some more information on all the options available.

Related

How to print conditional fields in PPFA code

How do I print a conditional field using PPFA code. When a value is an 'X' then I'd like to print it. However, if the 'X' is not present then I'd like to print an image. Here is my code:
LAYOUT C'mylayout' BODY
POSITION .25 in ABSOLUTE .25 in
FONT TIMES
OVERLAY MYTEMPOVER 8.5 in 11.0 in;
FIELD START 1 LENGTH 60
POSITION 2.0 in 1.6 in;
Where it has FIELD START 1 LENGTH 60 that will print the given text at that location. But based on the value I want to print either the given text or an image. How would I do that?
Here is an answer from the AFP-L list:
I would create two PAGEFORMATS, one with LAYOUT for TEXT and one with LAYOUT for IMAGE. With CONDITION you can jump between the Pageformats (where Copygroup is always 'NULL')
If you work in a z/OS environment, be careful of 'JES Blanc Truncation'.
That means in one sentence:
if there is a X in the data, condition is true
if there is nothing in the data, condition doesn't work and is always wrong (nothing happens)
In this case you must create a Condition which is always true. I call it a Dummy-Condition.
PPFA sample syntax:
CONDITION TEST start 1 length 1
when eq 'X' NULL PAGEFORMAT PRTTXT
when ge x'00' NULL PAGEFORMAT PRTIMAGE;
You must copy this CONDITION into both PAGEFORMATS after LAYOUT command.
Blanc truncation is a difficult problem on z/OS.
In this sample, the PAGEFORMAT named PRTTXT contains all the formatting and printing directives when the condition is true, and the other called PRTIMAGE contains every directive needed to print the image.
HTH

Ruby Selenium send_keys_characters not sending the strings I want

xlsx = Roo::Excelx.new($docs_dir + '/mytestsheet.xlsx')
xlsx.each_row_streaming do |row|
send_keys_characters(row)
step %[I wait for 2 sec]
end
end
I've been struggling with pulling the values from an xlsx file and sending each cell with send_keys_characters into a manual input field on my website; I have 2 issues here and I can't seem to figure out the solutions:
it does not pull ONLY the value of the cell I want e.g "test1", "test2", instead it writes one after the other excel feature:
[#<Roo::Excelx::Cell::String:0x0000000008076b30 #cell_value="test1", #style=0, #coordinate=[1, 1], #value="test1">]
[#<Roo::Excelx::Cell::String:0x0000000006399800 #cell_value="test2", #style=0, #coordinate=[2, 1], #value="test2">]
How can I pull only the value of the cell and mention it on my input field and then Submit?
It needs to pick up the first value and then Submit and continue the scenario and then to return and pick the second value and third and so forth... How can I pick one value at a time and then go to the next step?
This is a ruby / selenium question.
So in essence your problem is looking for the code to enumerate over your objects and send the values you want.
I'm not familiar with Roo, but if they use standard readers then you can just do
array.each do |excel_string|
input_field.send_keys(excel_string)
end
This will concatenate all of the values, so your input field will say test1test2 e.t.c.
If you need to type these in across a set of fields i.e. input_field 1/2/3 I would use #zip to create a 2d-array pair
text_values = array.map(&:value)
zipped_array = input_fields.zip(text_values)
zipped_array.each do |input_field, value|
input_field.send_keys(value)
end

Query date range and product size from xlsx file

I'm using python 3.6 to do this. Below are just a few important columns that I'm interested to query out.
Auto-Gen Index : Product Container : Ship Date :.......
0 : Large Box : 2017-01-09:.......
1 : Large Box : 2012-07-15:.......
2 : Small Box : 2012-07-18:.......
3 : Large Box : 2012-07-31:.......
I would like to query rows that indicate Large Box as their product container and the shipping date must be in the period of July in the year of 2012.
file_name = r'''Sample-Superstore-Subset-Excel.xlsx'''
df = read_excel(file_name, sheet_name = my_sheet)
lb = df.loc[df['Product Container'] == 'Large Box'] //Get large box
july = lb[(lb['Ship Date'] > '2012-07-01') & (lb['Ship Date'] < '2012-07-31')]
I just wonder how to use query and where condition by python(pd.query())?
If your question is when to use loc vs where, see my answer here:
Think of loc as a filter - give me only the parts of the df that
conform to a condition.
where originally comes from numpy. It runs over an array and checks if
each element fits a condition. So it gives you back the entire array,
with a result or NaN. A nice feature of where is that you can also get
back something different, e.g. df2 = df.where(df['Goals']>10,
other='0'), to replace values that don't meet the condition with 0.
If you are asking when to use query, AFAIK there is no real reason to do besides performance. If you have a very large dataset, query is expected to be faster. More on high-level performance here.

Reordering data by manipulating column wise in Python

I have data in a csv file as follows:
60,27702,1938470,13935,18513,8
60,32424,1933740,16103,15082,11
60,20080,1946092,9335,14970,2
60,28236,1937936,13799,16871,6
60,22717,1943455,10809,16726,4
120,37702,2938470,23935,28513,8
120,42424,2933740,26103,25082,11
120,30080,2946092,2335,24970,2
120,38236,2937936,23799,26871,6
120,32717,2943455,20809,26726,4
180,47702,3938470,33935,8513,8
180,52424,3933740,36103,5082,11
180,40080,3946092,3335,4970,2
180,48236,3937936,33799,6871,6
180,42717,3943455,30809,6726,4
I then used the following code to insert column heading:
df = pd.read_csv("contikiMAC_new_out.csv", names=['Energest','CPU','LPM','Transmit','Listen','ID'])
I used df.groupby(['ID']) to see the data in group according to column 'ID'.
The problem is the data in column 'LPM' gets reset after some time so I would like to add the previous value with the new value whenever the new value in LPM column is smaller for specific 'ID' .
I tried doing :
for x in df.groupby(['ID']):
for i in df.ID:
if (df.loc[i, 'LPM'] < df.loc[i - 1, 'LPM']):
df.loc[i, 'LPM'] = df.loc[i, 'LPM'] + df.loc[i - 1, 'LPM']
But actually not getting the fruitful result I desire because it mixes with the 'LPM' value of different 'ID' and the process takes a long time. Can anyone please help me in suggesting a way to write the data group wise in a csv file based on 'ID' after performing the sum operation ?
The data structure I like to see is as follows:
60,27702,1938470,13935,18513,8
120,37702,2938470,23935,28513,8
180,47702,3938470,33935,37026,8
60,32424,1933740,16103,15082,11
120,42424,2933740,26103,25082,11
180,52424,3933740,36103,30164,11
60,20080,1946092,9335,14970,2
120,30080,2946092,2335,24970,2
180,40080,3946092,3335,29940,2
60,28236,1937936,13799,16871,6
120,38236,2937936,23799,26871,6
180,48236,3937936,33799,33742,6
60,22717,1943455,10809,16726,4
120,32717,2943455,20809,26726,4
180,42717,3943455,30809,33452,4
If I understood your problem correctly, DataFrame.shift is what you're looking for.
Something like:
df['LPM_prev'] = df.groupby(['ID'])['LPM'].shift(1)
And then you can work with that column

LoadRunner Correlation 'Ord' random issue

I am able to capture the response using ord=All in web_reg_save_param.
case 1,
Input:12345
Response:["18/3/2017","20/2/2017","20/2/2016"].
case 2,
Input:98451
Response:["12/1/2017","01/1/2016"]
web_reg_save_param("date","LB=\"","RB=\"","ORD=ALL","LAST);
`
Captured Values are:
date_1:18/3/2017
date_2:,
date_3:20/2/2017
date_4:,
date_5:20/2/2016
Here is the task:
1) I need to fetch random date each time.
2) Date may vary depending upon the input(In case 1, 3 dates and case 2, 2 dates).
I have tried:
1) Correlating and using lr_paramarr_random() function- failed, it will fetch ',' at some point.
2) using for loop and if statement to find out odd/even position.
Using web_reg_save_param() function like you did will, of course, fetch a comma(',') since it is situated between two quote symbols(' " ').
You can use web_reg_save_param_regexp() function with the following regular expression:
"(\d{2}\/\d\/\d{4})"
Set the parameters: "Ordinal=All", "Group=1".
This function will extract the dates and store them into an array.
This time lr_paramarr_random() should return correct results because now your array contains nothing but dates.

Resources