如何在Crystal Report公式中为URL拼接订单号与固定数值参数并生成可调用链接
Solution for Adding Fixed Parameters to Crystal Report URL Formula
Hey there, adding those fixed parameters to your URL is straightforward—you just need to append them as query string parameters using the & separator, and convert your numeric variables to strings first since you're concatenating with a string URL.
Here's the revised formula that includes all your required parameters:
stringvar replaceid := Replace(totext({GET_ALLORDER_RESULT_PRINT_CASH;1.order number}), ",", ""); stringvar replaceids := Replace(replaceid, ".00", ""); numberVar testid := 6438; numberVar deptid := 11; numberVar culture := 2; // Build the full URL with all parameters stringVar barcodeInput:= "http://www.store.com/RPT/WebForm1.aspx?order_id=" & replaceids & "&testid=" & totext(testid) & "&deptid=" & totext(deptid) & "&culture=" & totext(culture);
Quick breakdown of the changes:
- Each fixed parameter is added as a new query string segment using
¶mName=valueformat - We use
totext()to convert the numeric variables (testid,deptid,culture) to strings so they can be safely concatenated with the URL - The original order ID processing logic stays intact—we just extend the URL string to include the new parameters
If you want to clean up the formula a bit (combining the replace steps into one line), you can also write it like this for brevity:
stringvar replaceids := Replace(Replace(totext({GET_ALLORDER_RESULT_PRINT_CASH;1.order number}), ",", ""), ".00", ""); numberVar testid := 6438; numberVar deptid := 11; numberVar culture := 2; stringVar barcodeInput:= "http://www.store.com/RPT/WebForm1.aspx?order_id=" & replaceids & "&testid=" & totext(testid) & "&deptid=" & totext(deptid) & "&culture=" & totext(culture);
Either version will generate a valid, fully-functional URL that includes all your required parameters.
内容的提问来源于stack exchange,提问作者Ziad Adnan
相关产品推荐
相关产品推荐

