Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create data-structure.php #203

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions samples/data-structure.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Data structure is easy to add. It's just another parameter.

$param = []; // initialize parameter array

// add parameters as desired
$param[] = $tk->AddParameterChar('in', 10,'Name', 'PTNAME', 'Fred');
$param[] = $tk->AddParameterChar('in', 25,'Address', 'PTADDR', '123 Toolkit Drive');

// DATA STRUCTURE
// Define the data structure as an array of basic parameter types or other data structures
$ds = [];
$ds[] = $tk->AddParameterChar('in', 21,'Part', 'PTPRT', 'A123');
$ds[] = $tk->AddParameterChar('in', 3,'Vendor', 'PTVEN', '825');
$ds[] = $tk->AddParameterChar('out', 20,'Description', 'PTDES', $out);
$ds[] = $tk->AddParameterZoned('out', 9, 2, 'Price', 'PTPRC', $out);

// Add the data structure as just another element in your main parameter array.
$param[] = $tk->AddDataStruct($ds, 'myds');

// Add additional regular parameters as needed
$param[] = $tk->AddParameterZoned('in', 5, 2, 'Discount', 'PTDISC', '0.24');