Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Why table "column styling rules" revert to "ROW #" ?

Joshman108
8 - Asteroid

1.png

 

As you can see I am configuring the column styling rules for a table. The red circled part was previously set to a column value but is now set to "Row #" which causes alteryx to error out when running.

 

I did not change this manually, it seems to have resulted from a seemingly unrelated upstream formula error. But it has impacted 5 rules across 15 columns across 6 tables, for a total of 450 changes I need to now correct, which I estimate would take a minimum of all day, or less than that once I figure out the regex on the xml file.

 

Why did it do this? Will it do it again?

 

Also while we're on it, the functionality on that red circled dropdown could really be improved  to 1) Allow two-finger scrolling when cursor within drowndown area 2) do NOT truncate column names when the dropdown is selected or unselected (or atleast allow user to expand). Both of these are serious time wasters. 

 

 

3 REPLIES 3
TrevorS
Alteryx Alumni (Retired)

Hello @Joshman108 

 

Can you please upload a copy of your workflow so that the Community can troubleshoot what caused this to happen?

Unfortunately, based on the screenshot, there isn't enough information to look into the cause of the issue.

If you can please share a sample data set as well, this will allow the Community to review further the issue you are encountering.

 

As for your enhancement requests, I would recommend submitting this as an Idea for further review.
Make sure to share the idea with anyone you feel may agree with the changes!


Thanks,
TrevorS

Community Moderator
Joshman108
8 - Asteroid

Thanks for the reply. No, I'm not interested in spending more time on this by de-sensitizing the workbook and getting a dataset. I will share the python code I used to fix the xml for any future readers:

 

 

# RIGHT CLICK ON DOWNLOADED alteryx file -> EDIT WITH NOTEPAD++
# COPY/PASTE INTO FILE.TXT
# LOAD IT INTO PYTHON WITH THE FOLLOWING LINE
f = open(r"c:\\users\....\file.txt", "r")
f=f.readlines()
text=''.join(f)
import re

# THE FOLLOWING LIST OF INTEGERS ARE THE CURRENT, ACTIVE TABLE TOOL IDS THAT BROKE. 
# THE REGEX GETS THE ENTIRE TABLE XML
tables=[i for i in re.findall(r'.?\<Node ToolID="(.*?)</Node>',text,flags=re.DOTALL) 
     if '1333">\n' in i or 
     '1323">\n' in i or 
     '1029">\n' in i or 
     '1039">\n' in i or 
     '1151">\n' in i or 
     '1167">\n' in i or 
       '1031">\n' in i or
        '1042">\n' in i or
        '1070">\n' in i or
        '1084">\n' in i or
        '1036">\n' in i or
        '1045">\n' in i or
        '1289">\n' in i or
        '1275">\n' in i or
        '1247">\n' in i or
        '1232">\n' in i]


for table in tables:
    tb=table
    rules=[i for i in re.findall(r'.?\<Rule Name=(.*?)</Rule>',table,flags=re.DOTALL)] 
    for rule in rules:
	    # WHEN ALTERYX FLIPS OUT AND SETS ALL THE RULES TO "ROW#" INSTEAD OF THE COLUMN VALUE,
		# THAT IS REPRESENTED IN THE XML AS "SIMPLEVAR />", WHICH WE SIMPLY NEED TO REPLACE WITH OUR DESIRED COLUMN VALUE
        if '<SimpleVar />' in rule:
            t=rule
            if 'Order Volume' in rule: # "Order Volume" is the column which formatting is being applied to
                b=t.replace('<SimpleVar />','<SimpleVar>Order Volume Flag</SimpleVar>') # "Order Volume Flag" is the column you want to use as a formatting guide, to replace the "Row#" value
                tb=tb.replace(t,b)
            if 'Automation Rate' in rule:
                b=t.replace('<SimpleVar />','<SimpleVar>Automation Rate Flag</SimpleVar>')
                tb=tb.replace(t,b)
            if 'Self Install Rate' in rule:
                b=t.replace('<SimpleVar />','<SimpleVar>Self Install Rate Flag</SimpleVar>')
                tb=tb.replace(t,b)
            if 'Prepay Rate' in rule:
                b=t.replace('<SimpleVar />','<SimpleVar>Prepay Rate Flag</SimpleVar>')
                tb=tb.replace(t,b)
            if 'CV3 Call Rate' in rule:
                b=t.replace('<SimpleVar />','<SimpleVar>CV3 Call Rate Flag</SimpleVar>')
                tb=tb.replace(t,b)
            if 'Abandon Rate' in rule:
                b=t.replace('<SimpleVar />','<SimpleVar>Abandon Rate Flag</SimpleVar>')
                tb=tb.replace(t,b)
    text=text.replace(table,tb)
	
# WRITE YOUR FILE BACK OUT AND THEN COPY/PASTE INTO THE XML FILE. SAVE AND REOPEN IN ALTERYX.
# SOMETIMES ALTERYX DOES NOT REGISTER IT ALL CORRECTLY ON THE FIRST TIME. YOU MAY NEED TO 
# OPEN AND RE-RUN MORE THAN 1 TIME. FOR ME, IT TOOK RUNNING THE UPDATED XML TWICE TO GET THE
# CHANGES TO REGISTER ACROSS ALL TABLES.
myText = open(r"c:\\users\....\file.txt",'w')
myText.write(text)
myText.close()

 

Above fixes the Row# references, but alteryx reorders columns in this process too. Use this to reorder columns:

 

# THIS ASSUMES COLUMNS ARE IDENTICAL FOR ALL TABLES
for table in tables:
    tb=table
    original_ordered_columns=re.findall(r'.?\<TableFields(.*?)</TableFields>',tb,flags=re.DOTALL)[0]
    updated_original_columns=original_ordered_columns
    target_columns=['orderChanged="False">\n',
	                # THE FIELD NAME IS YOUR COLUMN YOU WANT SELECTED IN THE TABLE
                    '<Field name="Legacy Company" selected="True" Alignment="Left" Borders="Left" Width="" />\n',   
                    '<Field name="Billing System" selected="True" Alignment="Left" Width="" Borders="Right" />\n',
                    '<Field name="Automation Rate" selected="True" Alignment="Right" Borders="Left" />\n'
					# .... ETC
					] 

    # Remove them so they can be manually set to the proper order
    for col in target_columns:
        updated_original_columns=updated_original_columns.replace(col,'')
    
	# ORDERCHANGED MUST = TRUE, OTHERWISE ALTERYX SETS THEM BACK TO THE WRONG POSITION AT RUNTIME
    insert='orderChanged="True">\n'+\
	                   # ORDER YOUR COLUMNS HOW YOU WANT THEM. FORMATTING COULD BE IMPROVED... DIDN'T HAVE MORE TIME.
                       '<Field name="Legacy Company" selected="True" Alignment="Left" Borders="Left" Width="" />\n            '+ \
                        which_lookup[which] + '            '+\
                        '<Field name="Order Volume" selected="True" Alignment="Right" Borders="Left" Width="" Places="0" />\n'+ '            '+ \
                        '<Field name="Avg Order Volume" selected="True" Alignment="Right" Alias="Average Order Volume" Width="" Places="0" Borders="Right" />\n'
    new_ordered_columns=insert+updated_original_columns 
    new_ordered_columns=new_ordered_columns.replace('','')
    tb=tb.replace(original_ordered_columns,new_ordered_columns) 
    text=text.replace(table,tb) 
    # WRITE OUT THE TEXT FILE PER OTHER CODE SECTION	

 

Joshman108
8 - Asteroid

And for any future readers, this issue is created by what I describe in this post

https://community.alteryx.com/t5/Alteryx-Designer-Discussions/How-is-XML-in-tables-supposed-to-work/...

To avoid this issue just try to avoid any of those actions.

Labels