cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
danielsaf
Regular Visitor

Get API data in XML format and transform

Hello,

 

I'm loading XML data from a legacy SOAP WS (great post here on how to get it).

Some of the tags are empty and the Get Data interprets it as [Table] array. 

 

Capture.PNG

 

I need to get rid of the [Table] values, turn to 0 or blank.

I've tried all kind of Table.ReplaceValue and can't get it to work.

Below an output example of the XML

 

<?xml version="1.0" encoding="utf-8"?>
<ROOT>
    <result>
        <CARDS>
            <CARD>
                <FIELDS>
                    <F_N>Mike</F_N>
                    <P_N>Last</P_N>
                    <TID>1111111111</TID>
                    <ACTIVE_WORKER>1</ACTIVE_WORKER>
                    <MAIL>something@something.com</MAIL>
                    <CELL>222222222</CELL>
                    <USER_ROLE>master</USER_ROLE>
                    <LIMITED_PERMISSION></LIMITED_PERMISSION>
                </FIELDS>
            </CARD>
        </CARDS>
    </result>
</ROOT>

 

 

[First question in this amazing forum I've been following and learning from for years .... Smiley Very Happy]

1 ACCEPTED SOLUTION
v-yuezhe-msft
Microsoft
Microsoft

@danielsaf,

Please add an step into Advanced Editor of your query.

#"expandcolumn"= Table.TransformColumns(yourpreviousstep , {{"LIMITED_PERMISSION", each if Value.Is(_, type table) then 0 else _ }} )

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Microsoft
Microsoft

@danielsaf,

Please add an step into Advanced Editor of your query.

#"expandcolumn"= Table.TransformColumns(yourpreviousstep , {{"LIMITED_PERMISSION", each if Value.Is(_, type table) then 0 else _ }} )

1.PNG

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Excellent, exactely what I was looking for.

Is there a way to do it once for all columns or simply repeat the columns like this

 

    #"Expandcolumn"= Table.TransformColumns(#"Removed Columns", {{"LIMITED_PERMISSION", each if Value.Is(_, type table) then 0 else _ },{"USER_ROLE", each if Value.Is(_, type table) then "" else _ }} ),

@danielsaf,

Please repeat this step for all the columns that you need to expand.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Power BI December 2021 Update_carousel 768x460.jpg

Check it Out!

Click here to read more about the December 2021 Updates!

User Group Leader Meeting January 768x460.png

Calling all User Group Leaders!

Don't miss the User Group Leader meetings on January, 24th & 25th, 2022.

Jan 2022 Dev Camp 768x460 copy.png

Power BI Dev Camp- January 27th, 2022

Mark your calendars and join us for our next Power BI Dev Camp!

Top Solution Authors