Change parameters of Web.Contents based on filename

mjhaston

New member
Joined
Dec 27, 2017
Messages
9
Reaction score
0
Points
0
I'm creating a quote template in Excel. I somehow need to change the data source to feed each quote created. Ideally, I would be able to access some parameters embedded in the filename (not really path) and use them in my Web.Contents code as variables. Right now I have a connection setup to make a call to a program which returns JSON data.

Code:
let
    Source = Json.Document(Web.Contents("http://myipaddress/jsonfeed.pgm" & "?sessionid=" + sessionid & "&quote=" + quote)),
    data = Source[data],
    #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "items"}}),
    #"Expanded items" = Table.ExpandRecordColumn(#"Renamed Columns", "items", {"pgprdc", "pgdesc", "pgpca1", "pgpsno", "pgptpe", "pgpgrp", "pgagrp", "pgpca2", "pgpca3", "pglpco", "pgtlpc", "pgapco", "pgtapc", "pgstco", "price", "freight", "cost", "pgprdcs1", "pgprdcs2", "pgmsup", "pusupp", "puunit", "punppd", "punpp1", "naname", "groupName"}, {"items.pgprdc", "items.pgdesc", "items.pgpca1", "items.pgpsno", "items.pgptpe", "items.pgpgrp", "items.pgagrp", "items.pgpca2", "items.pgpca3", "items.pglpco", "items.pgtlpc", "items.pgapco", "items.pgtapc", "items.pgstco", "items.price", "items.freight", "items.cost", "items.pgprdcs1", "items.pgprdcs2", "items.pgmsup", "items.pusupp", "items.puunit", "items.punppd", "items.punpp1", "items.naname", "items.groupName"})
in
    #"Expanded items"


Is it okay to feed via the Web.Contents call? Should I rather feed this from a .csv file where that filename changes? I've been reading a few threads about using a Parameter table and filename, but I'm a little lost!

All suggestions welcome! Thanks in advance.
 
Following the directions to get the filename into a parameter, I was able to change the parameters accordingly. I'm sure I'll be back to post my next challenge soon!
 
Back
Top