PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Properties specific to the description of URI variables
  • Functions that manipulate URI variables
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
URI (Type of variable)
In french: URI
The URI (Uniform Resource Identifier) type identifies physical or abstract resources (e.g. files or Web pages).
There are two types of URIs:
  • URLs (Uniform Resource Locator): identify a resource through its location and the means to access it.
    Examples:
    • Web address: https://www.windev.com/windevmobile/index.html
    • Location of a file on disk: file:///C:/Users/johndoe/Documents/log.txt
  • URNs (Uniform Resource Name): identify a resource by its name. They do not make it possible to locate the resource but must remain unique and persist even if the resource no longer exists or becomes unavailable.
    Example: ISBN number: urn:isbn:0-395-36341-1
A URI can be represented as a character string whose syntax complies with the standard defined by RFC 3986. Each URI can contain up to five parts:
<scheme>: [//<authority>]<path>[? <query>] [ # <fragment> ]
  • The URI scheme is a letter followed by any combination of letters, numbers, plus sign (+), period (.) or dash (-) and ends with a colon (:). In the case of a URL, it generally corresponds to the protocol to be used to access the resource: http, https, ftp, etc.
  • The authority of the URI is an optional part that corresponds to the identification information to access the resource. Its format is usually:
    [<user>[:<password>]]host[:<port>]
  • The path is a sequence of segments separated by slashes (/). In the case of a URL on a Web page for example, it represents the path to the resource on the host.
  • The request is an optional part preceded by a? and followed by a set of pairs ' key=value' separated by '&'. In the case of a URL on a web page for example, it allows you to pass named parameters to the page.
  • The fragment is an optional part preceded by a '#' that allows providing additional information to access a secondary resource (page number, anchor of an HTML page, etc.).
Example of URI:
Remark: For more details on the declaration of this type of variable and the use of WLanguage properties, see Declaring a variable.
Example
AndroidAndroid Widget
// Open the system window to select an image
UriResource is URI = URISelect(uriImage)
IF NOT ErrorOccurred THEN
// Load the resource
URIToBuffer(UriResource, ProcLoad)
INTERNAL PROCÉDURE ProcLoad(bResult, buffer)
IF bResult THEN
// Save the image in the database
HLinkMemo(Client, Photo, buffer)
HModify(Customer)
END
END
END
iPhone/iPad
// Open the system window to select an image
URISelect(MyProcURISelect, uriImage)
 
INTERNAL PROCÉDURE MyProcURISelect(Success, UriResource)
IF Success = True THEN
// Load the resource
URIToBuffer(UriResource, ProcLoad)
INTERNAL PROCÉDURE ProcLoad(bResult, buffer)
IF bResult THEN
// Save the image in the database
HLinkMemo(Client, Photo, buffer)
HModify(Customer)
END
END
END
END
Remarks

Properties specific to the description of URI variables

The following properties can be used to handle a URI variable:
Property nameType usedEffect
AuthorityCharacter string
  • "Authority" part of the URI,
  • Empty string if not specified.
This property is available in read and write mode.
FragmentCharacter string
  • Fragment of the URI,
  • Empty string if not specified.
This property is available in read and write mode.
HostCharacter string
  • Host of the URI,
  • Empty string if not specified.
This property is available in read and write mode.
Caution: If the Host property is modified:
  • the User and Password properties are reset: you need to assign a value to these two properties.
  • the Port property is reset: a value has to be assigned to the Port property as well.
PathCharacter stringPath of the URI.
This property is available in read and write mode.
PortInteger
  • Port number (between 1 and 65365),
  • 0 if not specified.
This property is available in read and write mode.
QueryCharacter string
  • Query found in the URI,
  • Empty string if not specified.
This property is available in read and write mode.
SchemeCharacter stringScheme found in the URI.
If changes are made, this property is mandatory and cannot be empty.
This property is available in read and write mode.
UserCharacter stringUsername.
This property is available in read and write mode.
UserPasswordCharacter string
  • User password,
  • Empty string if not specified.
This property is available in read and write mode.
ValueCharacter stringComplete URI.

You can use VariableReset to reset the contents of a variable of type URI.

Functions that manipulate URI variables

The following functions handle URI variables:
BufferToURISaves the contents of a buffer to a resource identified by its URI.
FileToURISaves the contents of a file to a resource identified by its URI.
URIGetInfoRetrieves information of a URI resource.
URISelectOpens a system window to select a resource from:
  • from the device file system,
  • from the Cloud (Google Drive, Microsoft OneDrive, etc.)
  • or from one of the content managers installed on the device.
URIToBufferLoads in the background the content of a resource (image, text, etc.) identified by its URI in a buffer variable.
URIToFileSaves, in the background, the content of a resource (image, text, etc.) identified by its URI in an external file.
See also
Minimum version required
  • Version 24
This page is also available for…
Comments
Click [Add] to post a comment